【发布时间】:2013-11-11 05:15:08
【问题描述】:
我在弹出框内添加了一个导航控制器。该视图包含一个我想部分覆盖的图像。在iOS6 中是在导航栏的后面,在ios7 中正好相反。附上截图。 有谁知道为什么?
【问题讨论】:
标签: ios ipad uinavigationcontroller uipopovercontroller
我在弹出框内添加了一个导航控制器。该视图包含一个我想部分覆盖的图像。在iOS6 中是在导航栏的后面,在ios7 中正好相反。附上截图。 有谁知道为什么?
【问题讨论】:
标签: ios ipad uinavigationcontroller uipopovercontroller
在 iOS 7 中,默认情况下布局会扩展容器的边缘。这是edgesForExtendedLayout 视图控制器属性的控制器。如果您希望布局以与导航栏对齐的顶部开始,您需要通过设置self.edgesForExtendedLayout 来禁用它。
例如:
- (id)init
{
if ((self = [super init])) {
// layout with top of view starting at bottom of navigation bar
self.edgesForExtendedLayout = UIRectEdgeNone;
// continue with init
}
}
【讨论】:
如果不需要导航栏半透明,可以试试navigationBar.isTranslucent = NO。
【讨论】:
使用自动布局约束:http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1
或者试试这个(没有优雅的解决方案):
NSString *ver = [[UIDevice currentDevice] systemVersion];
float ver_float = [ver floatValue];
if (ver_float >= 7.0f)
{
CGRect frame = self.myView.frame;
frame.origin.y = self.navigationBar.frame.size.height;
[self.myView setFrame:frame]
}
【讨论】: