0
我在Interface Builder中创建了一个.nib file,带有1个UIView项目,但是当我以编程方式初始化它时,视图不覆盖整个屏幕,只留下一小部分视图在它下面可见。从.nib文件加载时调整视图的大小
它看起来像Y坐标是在一些负面的位置,而不是在0.我没有一个导航栏配置视图,但如果我要设置它,栏不显示。
我创建的appDelegate类的内部这样的观点:
MyCustomController *controller = [[MyCustomController alloc] initWithNibName:@"MyCustomView" bundle:nil];
[window addSubview:[controller view]];
设置在界面生成器的视图:
Orientation: Portrait
Status Bar: Gray
Top Bar: unspecified
Bottom Bar: unspecified
View mode: "Scale To Fill"
View Size/Position: Set to "Layout" and the X/Y, Width/Height are readonly with 0,0,320,460
我已经打印出来视图的帧和[ UIScreen mainScreen] bounds] on'viewWillAppear':
view.frame on viewWillAppear - x: 0.0, 0.0, 320.0, 460.0
bounds - x: 0.0, 0.0, 320.0, 480.0
我不确定为什么视图是ge tting转移 - 一旦视图被'initWithNibName'方法加载,读取帧大小的最佳位置是什么?这似乎是我能想到的解决方法。
状态栏是20px – thelaws 2010-08-24 19:06:27
状态栏正在显示,而不是试图隐藏它。在我最上面的视图是一个UITabBarController,我可以看到大约90%的标签栏按钮本身戳穿。 – 2010-08-24 19:09:42