【发布时间】:2013-09-30 07:50:22
【问题描述】:
我有一个 UIViewController,我想在我的 UITabBarController 上显示它,有点像自定义 UIAlertView。问题是,当我展示 UIViewController 时,我无法调整其视图的大小以适应当前正在使用的任何屏幕。 UIViewController(ShareViewController 是它的名字)是使用 .xib 文件设计的,目前使用的是 iPhone 5 的屏幕高度。如果应用程序在任何设备上运行,我基本上只是想调整其 UIView(视图)的大小,但是当我调用 setFrame 时它不起作用。
这里有一些代码:
ShareViewController * svc = [[ShareViewController alloc] initWithNibName:@"ShareViewController" bundle:nil];
self.tabBarController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.tabBarController presentViewController:svc animated:NO completion:nil];
[svc.view setFrame:[[UIScreen mainScreen] applicationFrame]];
我使用“UIModalPresentationCurrentContext”设置,以便可以显示具有透明背景的 ShareViewController。因此,当我运行此代码时,ShareViewController 刚刚被添加,但由于它仍处于 iPhone 5 的显示高度而离开屏幕。
如何调整 ShareViewController 主视图的大小?
【问题讨论】:
标签: ios objective-c