UIBarStyleBlack vs tintColor black

主宰稳场 提交于 2019-12-07 03:14:49

问题


What is the difference between setting the tintColor property of UINavigationBar to [UIColor blackColor] and setting barStyle to UIBarStyleBlack on opaque navigation bar?


回答1:


There are a few subtle differences. For example, on iPad, you get a matte style with the tint color, but a glossy one with the barStyle.

Also, the color of bordered UIBarButtonItems is slightly different; with the black barStyle, they are gray, which makes it easier to distinguish the darker highlighted state, while with a black tint color, the buttons look almost identical in normal and highlighted state.

I think UIBarButtonItems with 'Done' style also look different, but I'm not sure about that.




回答2:


There are only 2 options for barStyle: default and black. However, you can set the tintColor to anything you like: red, blue, green, orange, some funny rgb defined color, etc. The default tintColor for UIBarStyleBlack is, not surprisingly, [UIColor blackColor].

I recommend you just play around with how they look. Set the tint to something fun and toggle between styles. See what you prefer for your app.



来源:https://stackoverflow.com/questions/6146151/uibarstyleblack-vs-tintcolor-black

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!