statusbar and superview frame size
I've a typical View based application (mainwindow.xib + viewControler.xib) in which I have HIDDEN the status in the AppDelegate file like this...
[[UIApplication sharedApplication] setStatusBarHidden:YES];
then I create various subviews on the mainview (mainly UIWebViews) that are full screen positioned at 0,0. Then I created a button that enables you to toggle the view of the statusbar. My problem begins when I show the statusbar and the change the orientation of th开发者_C百科e screen, the views don't have the full dimension of window and are starting just after the statusbar (at y:20 instead of y:0) and their height is reduced by 20pixel and if I removed the status I can see the blank space.
So the question is this...how can the code ignore the presence of the statusbar and always position new or re-oriented views into 0,0, instead of 0,20 (if the statusbar is shown). I think that the problem is not lying on my main view but in my MainWindow.xib, but I cannot find any solution.
UPDATE1: I am also checking for a solution in the autoresizingmask property of the subviews.
Thanx in advance...
I finally found the solution and I can fall to sleep in peace.
The solution lies in the property wantsFullScreenLayout
and you must set it to YES
.
So visit your appDelegate that adds your mainview (superview) and add this line:
viewController.wantsFullScreenLayout = YES;
before this line
[window addSubview:viewController.view];
on didFinishLaunchingWithOptions
of your AppDelegate.m file.
That way your superview ALWAYS uses fullscreen resolution and doesn't resize if the statusbar is present!
精彩评论