【发布时间】:2011-02-24 09:25:26
【问题描述】:
我已经构建了带有 xib 文件和导航栏的视图控制器,这个视图控制器显示在拆分视图控制器的详细视图中,我已经从界面生成器设计了 xib,但是当我从横向模式旋转到纵向模式时,导航栏超出范围,视图中未显示小部分。
我该如何解决它。 提前谢谢
【问题讨论】:
标签: ipad uisplitviewcontroller uinavigationcontroller
我已经构建了带有 xib 文件和导航栏的视图控制器,这个视图控制器显示在拆分视图控制器的详细视图中,我已经从界面生成器设计了 xib,但是当我从横向模式旋转到纵向模式时,导航栏超出范围,视图中未显示小部分。
我该如何解决它。 提前谢谢
【问题讨论】:
标签: ipad uisplitviewcontroller uinavigationcontroller
在你的视图控制器中将 uinavigationbar 作为变量并连接到 xib 文件,然后在你里面写这个函数
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Override to allow orientations other than the default portrait orientation.
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) {
self.navigationBar.frame= CGRectMake(0, 175, 703,44);
} else {
self.navigationBar.frame= CGRectMake(0, 175, 768,44)
}
return YES;
}
希望这会有所帮助
【讨论】: