iOS development--Useful articles for Swift & status bar operations

Source: Internet
Author: User

Status bar Actions

During the swift development process, there are a number of procedures for status bar operations.

1. Operate the status bar of the current Viewcontroller in Viewcontroller

[OBJC]View Plaincopy
    1. /** 
    2. Hides the status bar  
    3. */  
    4. Override func  prefersstatusbarhidden ()  -> bool {  
    5.      return true;  
    6. }   
    7.   
    8. /** 
    9. < span class= "comment" > set the status bar style  
    10. */&NBSP;&NBSP;
    11. override func preferredstatusbarstyle ()  -> uistatusbarstyle {   
    12.     return uistatusbarstyle
    13. }  

2. Set the status bar in Appdelegate

[OBJC]View Plaincopy
  1. Func Setupwithstatusbar (application:uiapplication) {
  2. //Set status bar to hide
  3. Application. Statusbarhidden = true;
  4. Application. Setstatusbarhidden (True, withanimation:uistatusbaranimation.  Fade);
  5. //Set status bar highlighting
  6. Application. Statusbarstyle = Uistatusbarstyle.  Lightcontent;
  7. Application. Setstatusbarstyle (Uistatusbarstyle.  Lightcontent, animated: true);
  8. }


3. Configure status bar properties via Plist file

iOS development--Useful articles for Swift & status bar operations

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.