The UINavigationBar and UISearchBar both have a tintColor property that allows you to change the tint color (surprising, I know) of both of those items. I want to do the same thing to the UITabBar in my application, but have found now way to change it from the default black color. Any ideas?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
iOS 5 has added some new appearance methods for customising the look of most UI elements.
You can target every instance of a UITabBar in your app by using the appearance proxy.
For iOS 5 + 6:
For iOS 7 and above, please use the following:
Using the appearance proxy will change any tab bar instance throughout the app. For a specific instance, use one of the new properties on that class:
When you just use addSubview your buttons will lose clickability, so instead of
use:
I have been able to make it work by subclassing a UITabBarController and using private classes:
On iOS 7:
I also recommend setting first depending on your visual desires:
The bar style puts a subtle separator between your view content and your tab bar.
Swift 3 using appearance from your
AppDelegate
do the following:UITabBar.appearance().barTintColor = your_color