开发者

UIBarStyleBlack vs tintColor black

开发者 https://www.devze.com 2023-03-08 12:58 出处:网络
What is the difference between setting the tintColor property of UINavigationBar to [UIColor blackColor] and setting barStyle to UI开发者_JS百科BarStyleBlack on opaque navigation bar?There are a few s

What is the difference between setting the tintColor property of UINavigationBar to [UIColor blackColor] and setting barStyle to UI开发者_JS百科BarStyleBlack on opaque navigation bar?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消