dia*_*ich 6 iphone objective-c uitabbarcontroller uiview uinavigationcontroller
我在loadView中以编程方式创建了一个UIView .该应用程序有一个UITabBarController和UINavigationController.
当标签栏和导航栏都存在时,如何创建自动调整大小的视图?
我目前解决这个问题的方法是计算导航和标签栏控制器的高度,并从主屏幕的高度中减去它们:
float navObjectsHeight = self.tabBarController.tabBar.frame.size.height
+ self.navigationController.navigationBar.frame.size.height;
CGRect mainFrame = CGRectMake(0, 0, screenFrame.size.width,
screenFrame.size.height - navObjectsHeight);
UIView *contentWrapper = [[UIView alloc] initWithFrame:mainFrame];
Run Code Online (Sandbox Code Playgroud)
UIView有一个处理这种情况的财产.在以编程方式创建它时,要使用的代码是:
UIView *aView = [[UIView alloc] init];
aView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9210 次 |
| 最近记录: |