In an app which has the wantsFullScreenLayout
set to YES
, what is the best practice to handle an extended height status bar, i.e. with the extra status bar presented when a phone call or a VoIP app is present, or when the personal hotspot feature is activated?
Is the UIApplicationWillChangeStatusBarOrientationNotification
notification (or the corresponding delegate method of UIApplication
the right way to do it, or am I overlooking something obvious?
I have put up a little sample project here to demonstrate the issue.
Thanks
Alex
The status bar with extended height can only be shown on iPhone or iPod in Portrait orientation.
You can get notified when the status bar frame will change using the
UIApplicationWillChangeStatusBarFrameNotification
(notUIApplicationWillChangeStatusBarOrientationNotification
). This notification will also be posted when the interface orientation changes. On a frame change you could re-layout the views manually. Take the value of[UIApplication sharedApplication].statusBarFrame.size.height
into account. It is 40 points in case of the extended status bar.However, it is much simpler to hide the status bar completely for fullscreen view controllers so that the view can take advantage of the full display:
You could also do something similar like in the photos app: Use the translucent status bar style and let the user hide the status bar with a single tap or hide it automatically after some time (when the user is not interacting with the app). This should be animated. Use the method
setStatusBarHidden:withAnimation:
.Note that
wantsFullScreenLayout
is a view controller property and not a property of UIApplication. You need to be careful when not all view controllers are presented in full screen mode.From the Apple documentation:
This answer applies up to iOS 6, I'll update this post when iOS 7 is available.