1

I'm working through the Big Nerd Ranch's iOS Programming book (3rd edition), and there's one particular example that involves a full screen image embedded in a full screen UIScrollView. Both are created as follows:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
CGRect screenRect=[[self window] bounds];
UIScrollView *scrollView=[[UIScrollView alloc] initWithFrame:screenRect];
view=[[HypnosisView alloc] initWithFrame:screenRect];

We're asked to make the status bar disappear using the following line:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

Everything works fine, but what I don't understand is this: why are the window's bounds the same regardless of whether or not the status bar is there? They are always (0,0,320,568), but I would have expected the height to shrink if I hid the status bar.

Thanks for reading.

4

1 回答 1

1

[UIScreen mainScreen] bounds]始终返回设备的框架,无论您的应用显示或隐藏状态栏的天气如何,设备的框架始终相同。

于 2013-01-08T11:48:24.057 回答