Resolution of status bar related issues under IOS7

Source: Internet
Author: User

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
  1. #pragma mark-status Bar
  2. -(Uistatusbarstyle) Preferredstatusbarstyle
  3. {
  4. return uistatusbarstyledefault;
  5. }
  6. -(BOOL) Prefersstatusbarhidden
  7. {
  8. return _isfullscreen;
  9. }
  10. -(Uistatusbaranimation) preferredstatusbarupdateanimation
  11. {
  12. return uistatusbaranimationslide;
  13. }

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
      1. [uiview  Animatewithduration:.3 ANIMATIONS:^{  
      2.              if  (isios7)  {  
      3.                  [self setneedsstatusbarappearanceupdate];  
      4.             }  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.