Reprinted from: http://blog.csdn.net/volcan1987/article/details/14227313
The implementation of the status bar in the iOS7 is not the same as the iOS6, the previous time encountered this problem, today summarized under
First there are many solutions on the Internet, but some of them I do not follow the idea of Apple, such as the uiviewcontrollerbasedstatusbarappearance in the plist set to No method, this method is feasible, but not a "correct" , and there are some problems, such as when you hide the status bar in an interface, and return to the previous interface, the status bar is still hidden
First of all, Apple set uiviewcontrollerbasedstatusbarappearance default value to Yes, there is his reason, under the new system, Apple wants our viewcontroller to control the status bar, that is to say, Most of our interfaces should be unified, and occasionally some viewcontroller need to be specifically controlled by the status bar and given to the current viewcontroller entirely.
Code, where _isfullscreen requires you to call Setneedsstatusbarappearanceupdate
Set the appropriate values before
[OBJC]View Plaincopy
- #pragma mark-status Bar
- -(Uistatusbarstyle) Preferredstatusbarstyle
- {
- return uistatusbarstyledefault;
- }
- -(BOOL) Prefersstatusbarhidden
- {
- return _isfullscreen;
- }
- -(Uistatusbaranimation) preferredstatusbarupdateanimation
- {
- return uistatusbaranimationslide;
- }
This way, when you want to control the presentation of the status bar (you don't need the animation to remove it), you only need to call
[OBJC]View Plaincopy
- [uiview Animatewithduration:.3 ANIMATIONS:^{  
- if (isios7) {
- [self setneedsstatusbarappearanceupdate];
- }