user1898829
user1898829

Reputation: 3527

How to change text to custom font and use custom colour in iOS 7

How to change the unselected tabbaritem color in iOS7? This does not work.

I'm trying this

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:[ThemeManager customFont] size:10.0f],
                                                    NSForegroundColorAttributeName : [UIColor greenColor]
                                                    } forState:UIControlStateSelected];

Colour changes but not the custom font I'm using.

Upvotes: 1

Views: 104

Answers (1)

user1898829
user1898829

Reputation: 3527

Found the solution.

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:[ThemeManager customFont] size:17.0f],
                                                    NSForegroundColorAttributeName: [UIColor greenColor]}
                                         forState:UIControlStateSelected];

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:[ThemeManager customFont] size:17.0f],
                                                    NSForegroundColorAttributeName: [UIColor blackColor]}
                                         forState:UIControlStateNormal];

Upvotes: 1

Related Questions