【问题标题】:Resize navigation bar in detail view controller在详细视图控制器中调整导航栏的大小
【发布时间】:2011-02-24 09:25:26
【问题描述】:

我已经构建了带有 xib 文件和导航栏的视图控制器,这个视图控制器显示在拆分视图控制器的详细视图中,我已经从界面生成器设计了 xib,但是当我从横向模式旋转到纵向模式时,导航栏超出范围,视图中未显示小部分。

我该如何解决它。 提前谢谢

【问题讨论】:

    标签: ipad uisplitviewcontroller uinavigationcontroller


    【解决方案1】:

    在你的视图控制器中将 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;
    }
    

    希望这会有所帮助

    【讨论】:

      猜你喜欢
      • 2012-04-27
      • 2016-05-20
      • 2013-05-09
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多