3

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

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

但是有没有像 applicationFrame 这样的变量,它给出 applicationFrame 减去 UINavigationBar 高度?

4

1 回答 1

2

看起来没有,因为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

马特

于 2010-09-04T23:24:47.613 回答