Apple finally released the official version of iOS 7, and a large number of users have been upgraded. If the App is generated in Xcode 4.6 or earlier versions, the iOS 7 system runs the App in compatible mode to keep the original appearance as much as possible. However, when Xcode 5 is used to re-compile the App source code, the iOS 7 SDK is used to compile the link. (Note: Back up the source code of the project before using Xcode 5 to open the old project, because Xcode 5 will upgrade the resource file in the project and cannot open it using the old version of Xcode .) Because the iOS 7 SDK is greatly changed compared with earlier versions, there may also be various problems on the App interface. The most obvious problem is the display of the status bar and navigation bar.
IOS 6:
IOS7:
When the navigation bar is not used, the display on iOS 6 and iOS 7 is compared above. The status bar in iOS 6 is not transparent, and the origin of the View Controller is under the status bar. In iOS 7, the background color of the status bar changes to transparent. The origin of the View Controller's main view is in the upper left corner of the screen, that is, the status bar is displayed on the main view, and the View content can be displayed through the status bar.
IOS 7 provides two status bar styles to control the text color of the status bar.
typedef NS_ENUM(NSInteger, UIStatusBarStyle){ UIStatusBarStyleDefault = 0, // Dark content, for use on light backgrounds UIStatusBarStyleLightContent NS_ENUM_AVAILABLE_IOS(7_0) = 1, // Light content, for use on dark backgrounds UIStatusBarStyleBlackTranslucent NS_ENUM_DEPRECATED_IOS(2_0, 7_0, "Use UIStatusBarStyleLightContent") = 1, UIStatusBarStyleBlackOpaque NS_ENUM_DEPRECATED_IOS(2_0, 7_0, "Use UIStatusBarStyleLightContent") = 2,};
If the background of the status bar is light, you should use the black style (UIStatusBarStyleLightContent); if the background is dark, use the white style (UIStatusBarStyleDefault, default ).
Several new methods are added to the UIViewController class of iOS 7 to control the status bar.
// These methods control the attributes of the status bar when this view controller is shown. They can be overridden in view controller subclasses to return the desired status bar attributes.- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO// This should be called whenever the return values for the view controller's status bar attributes have changed. If it is called from within an animation block, the changes will be animated along with the rest of the animation block.- (void)setNeedsStatusBarAppearanceUpdate NS_AVAILABLE_IOS(7_0);
The preferredStatusBarStyle method is used to specify the status bar style of the current view controller. The prefersstatusbarhidmethod specifies whether to hide the status bar. When the font color, display, or hide of the status bar is modified, call the setNeedsStatusBarAppearanceUpdate method to notify the system to refresh the status bar.