【问题标题】:How to get the applicationFrame minus the height of the UINavigationBar?如何让 applicationFrame 减去 UINavigationBar 的高度?
【发布时间】:2011-01-27 23:55:08
【问题描述】:

我把它放在 loadView 中,它可以工作:

CGRect navFrame = [[UIScreen mainScreen] applicationFrame];
navFrame.size.height -= self.navigationController.navigationBar.frame.size.height;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:navFrame];

但是有没有像 applicationFrame 这样的变量,它可以让 applicationFrame 减去 UINavigationBar 的高度?

【问题讨论】:

    标签: iphone uiviewcontroller autoresizingmask


    【解决方案1】:

    看起来好像没有,因为three20 做了类似我所做的事情。在TTGlobalNavigatorMetrics.m,他们这样做:

    CGRect TTNavigationFrame() {
      CGRect frame = [UIScreen mainScreen].applicationFrame;
      return CGRectMake(0, 0, frame.size.width, frame.size.height - TTToolbarHeight());
    }
    

    http://github.com/facebook/three20/blob/master/src/Three20UINavigator/Sources/TTGlobalNavigatorMetrics.m#L53

    马特

    【讨论】:

      猜你喜欢
      • 2016-03-21
      • 2013-11-06
      • 1970-01-01
      • 2016-04-22
      • 2018-11-28
      • 2017-04-29
      • 2018-03-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多