Pergunta

translucent status bar by itself

In my app, I have some webviews. A transparent status bar doesn't look good for full screen webview. I want to make the status bar TRANSLUCENT, just like the game center.

I notice that the status bar would be drawn translucent if there is a navigation bar under it. But I want a translucent status bar BY ITSELF.

Is there any way to do this?

Foi útil?

Solução 2

As the status bar is totally transparent and any content can go on top of it, I just create an empty UIToolbar that is 20px height which just looks like a perfect translucent background for the status bar. This is not an ultimate solution, but it really helps and it is very easy to implement when you don't need a real tool bar. Thanks to Apple that they do not provide an option to set the status bar from transparent to translucent.

Outras dicas

If you look at the Human Interface Guidelines section about the Status Bar it recommends (emphasis mine on the section most related to your question):

Prevent scrolling content from showing through the status bar. As users scroll, you don’t want them to see a confusing mix of app content and status bar items in the status bar area. To give users the impression of spaciousness while still ensuring maximum readability, make sure the status bar has a background that obscures the content behind it. Here are a few ways to keep scrolling content from showing through the status bar:

  • Use a navigation controller to display content. A navigation controller automatically displays a status bar background and it ensures that its content views don’t appear behind the status bar. (To learn more about navigation controllers, see “Navigation
    Controllers”.)
  • Create a nondistracting custom image—such as a gradient—and display it behind the status bar. To ensure that the image stays behind the status bar, you could use a view controller to keep the image above a scrolling view or you could use a scrolling view to keep it pinned to the top.
  • Position content to avoid the status bar area (that is, the area defined by the app’s statusBarFrame property). If you do this, you should use the window’s background color to provide a solid color behind the status bar.

In Xcode 6, create top, bottom, left, right constrains and set the

- constants to 0
- priorities to 749.
- Don't forget to UNCHECK the "Constrain to margins" check box.

How to create constrains?
At the bottom right of your storyboard window, there's four buttons.
The second from your left has the constrains.
Please google about constrains in Xcode 6 since it's a kinda new feature. Hope this help,

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top