setModalTransitionStyle 和 setModalPresentationStyle,设置视图的大小

发布于 2024-11-04 09:16:54 字数 157 浏览 1 评论 0原文

我创建一个 UIViewController (一个自定义日历,其大小为 550x440),当我按下按钮时它必须出现;问题是,如果我使用 setModalPresentationStyle 和 setModalTransitionStyle 他们会改变我的视图的大小;我可以设置这些演示文稿的大小吗?

I create a UIViewController (a custom calendar and its size is 550x440) and when i push a button it must be appear; the problem is that if I use setModalPresentationStyle and setModalTransitionStyle they change size of my view; can I set the size for these presentation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

z祗昰~ 2024-11-11 09:16:54

我找到一个解决方案:

[self presentModalViewController:calendar animated:YES];

calendar.view.superview.frame = CGRectMake(0, 0, 200, 200);

I find a solution:

[self presentModalViewController:calendar animated:YES];

calendar.view.superview.frame = CGRectMake(0, 0, 200, 200);
白云不回头 2024-11-11 09:16:54

也许您想更改设计以将日历实现为弹出窗口:

// Define the size of the calendar view controller for the popover
UIViewController *viewController = [[UIViewController alloc] init];
viewController.contentSizeForViewInPopover = CGSizeMake(550.0f, 440.0f);
viewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;

// Create the popover
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:navigationController];

// Present the popover from one button
[popoverController presentPopoverFromBarButtonItem:button permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

//release the popover content
[viewController release];
[navigationController release];

Maybe you want to change your design to implement your calendar as a popover:

// Define the size of the calendar view controller for the popover
UIViewController *viewController = [[UIViewController alloc] init];
viewController.contentSizeForViewInPopover = CGSizeMake(550.0f, 440.0f);
viewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;

// Create the popover
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:navigationController];

// Present the popover from one button
[popoverController presentPopoverFromBarButtonItem:button permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

//release the popover content
[viewController release];
[navigationController release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文