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