How to make the status bar match the following search bar or Navigationbar or toolbar color in iOS

Source: Internet
Author: User

After iOS7, the status bar is transparent (transparent), navigation bars,tab bars,toolbars,search bars and scope bars are translucent (tranlucent).

After setting the background color or background image of these bars, it is necessary to expand the statusbar using the following method, but the result of the non-expansion is the color mismatch.

Add the following method, noting that the return value is different

-(Uibarposition) Positionforbar: (id<uibarpositioning>) bar{

Return uibarpositiontopattached;//make the status bar the same color as the search bar

}

  • uibarpositiontopattached represents a bar at the top of the screen and his background expands to the area of the navigation bar;
  • Uibarpositiontop indicates that a bar is located at the top of its local context, for example, at the top of a popover, and does not provide a background for the status bar.

How to make the status bar match the following search bar or Navigationbar or toolbar color in iOS

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.