IOS 7.1 UINavigationbar and UIToolbar

After updating Xcode in iOS7.1, my navigation bar and buttons UIToolbardo not appear with the correct color.

When the view first appears, the buttons UIToolbarare in the correct blue color by default, and when I go to the next page / view and return to the previous view, the toolbar buttons are grayed out.

I tried adding blue color to viewDidLoadand viewWillAppear, but no luck. Can someone please help me?

Thank.

+4
source share
1 answer

, . , setupTheme, - "" ​​, , [[UINavigationBar appearance] setBarTintColor:], . , , , , , .

- (void)setupTheme {
    // get our theme colors
    UIColor *primaryThemeColor = [UIColor blueColor];
    UIColor *secondaryThemeColor = [UIColor whiteColor];

    // nav bar
    [[UINavigationBar appearance] setBarTintColor:primaryThemeColor];
    [[UINavigationBar appearance] setTintColor:secondaryThemeColor];
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:secondaryThemeColor}];

    // tab bar
    [[UITabBar appearance] setTintColor:primaryThemeColor];

    // switches
    [[UISwitch appearance] setOnTintColor:primaryThemeColor];

    // search bar
    [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateNormal];
}

iOS 7 https://developer.apple.com/library/iOs/documentation/UserExperience/Conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW1

0

Source: https://habr.com/ru/post/1531689/


All Articles