开发者

How to get the applicationFrame minus the height of the UINavigationBar?

开发者 https://www.devze.com 2023-01-14 16:54 出处:网络
I put this in loadView and it works: CGRect navFrame = [[UIScreen mainScreen] applicationFrame]; navFrame.size.height -= self.navigationController.navigationBar.frame.size.height;

I put this in loadView and it works:

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

But is there a variable like applicationFrame that gives the appl开发者_StackOverflow中文版icationFrame minus the UINavigationBar height?


Looks like there isn't since three20 does something similar to what I did. In TTGlobalNavigatorMetrics.m, they do:

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

Matt

0

精彩评论

暂无评论...
验证码 换一张
取 消