I tried to test my app in iOS 7, and then I find my view appears over the status bar... As I read, in iOS 7, the status bar is hidden. So how do I make it compatible to run both in iOS 6 and iOS 7? Should I have to make different .xib files for different iOS versions for each screen?
I have been going through reading this: If both versions of a standard app should have a similar layout, use Auto Layout to create a UI that works correctly in both versions of iOS. To support multiple versions of iOS, specify a single set of constraints that Auto Layout can use to adjust the views and controls in the storyboard or XIB files (to learn more about constraints, see “Constraints Express Relationships Between Views”).
If both versions of a standard app should have a similar layout, and you’re not using Auto Layout, use offsets. To use offsets, first update the UI for iOS 7. Next, specify values that define the origin, height, and width of each element in the earlier UI as offsets from the element’s new position in the iOS 7 UI.
But when I use autolayout in .xib, it shows an error that autolayout is in a prior version to iOS 6.
How do I fix this problem?
To completely hide it on the home screen, open up an app, such as Settings, and wait about three to four seconds. Press the home button again, and the status bar will be completely gone. The status bar will only be hidden on your home screen, so you'll still see it while using apps.
A status bar appears along the upper edge of the screen and displays information about the device's current state, like the time, cellular carrier, and battery level.
How To Fix A Missing iPhone Status Bar. 99% of the time, restarting your iPhone will fix this problem. On an iPhone 8 or earlier, press and hold the power button until the words “slide to power off” appear on the display. Then, swipe the power icon from left to right to turn off your iPhone.
iOS 7 apparently supports the Status Bar being hidden for some views but not others. To hide it for all views, do the following:
Hide during application launch
is still checked, to support previous OS versions.View controller-based status bar appearance
and set it to NO
. You probably need to add the following code on each view controller.
- (void)viewDidLoad { [super viewDidLoad]; if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { [self prefersStatusBarHidden]; [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; } else { // iOS 6 [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; } } // Add this method - (BOOL)prefersStatusBarHidden { return YES; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With