Ada*_*dam 3 uinavigationcontroller ios
Apple的文档说:
Note: Because the amount of space available for the custom view can vary
(depending on the size of the other navigation views), your custom view’s
autoresizingMask property should be set to have a flexible width and height.
Before displaying your view, the navigation controller automatically
positions and sizes it to fit the available space.
Run Code Online (Sandbox Code Playgroud)
这很好,除了...我需要知道UINavController将在视图添加到帧之前使用的大小,因为我将显示的内容根据大小而不同.
这是在UIViewController的"loadView"方法中,它被添加到UINavigationController中.
好吧,从技术上讲,你不应该在loadView方法中调整子视图的大小.我不使用笔尖,几乎所有的视图控制器loadView都非常小:self.view = [[UIView alloc] init];.然后,viewDidLoad我将所有子视图添加到self.view.最后,我完成了所有调整大小viewWillAppear,因为在那一点self.view上将是适当的大小.
如果你必须在loadView方法中调整视图大小,你必须手动计算尺寸...即:找出设备的方向(self.interfaceOrientation)确定屏幕尺寸,减去你认为在屏幕上的任何其他元素(如导航栏等).但不建议使用此方法.
| 归档时间: |
|
| 查看次数: |
2559 次 |
| 最近记录: |