Navigation Controller Transparent Bar Style is not working

前端 未结 12 776
情书的邮戳
情书的邮戳 2020-12-31 13:57

I am using a navigation controller, and I have the style set to :

navController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

But wh

12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 14:29

    I believe the UINavigationController assumes that your controller view frames don't include the area beneath the navigation bar.

    UIBarStyleBlackTranslucent is more often used for UIToolbar, so Apple probably didn't make it easy to use it nicely with UINavigationBar. You'll probably need to abandon the UINavigationController, or start hacking the frames (careful with rotations), if you want to reliably render under the bar area.

    Also, if your intention is to hide the navigation bar after a few seconds, you'll have a much easier time if you make it fade out (like the Photos app) instead of trying to slide it up (like Mobile Safari). Trust me on that one... that took me a lot of time to learn the hard way.

提交回复
热议问题