1

How i can set custom font for every UITabBarItem. All i found is [[UITabBarItem appearance] setTitleTextAttributes:...] But it sets the same attributes for all tabs. I want to set attributes for every UITabBarItem and it must be custom. This method like [tabBarItem setTitleTextAttributes:forState:] doesn't work.

dpart
  • 157
  • 2
  • 13
  • `[self.tabBarItem setTitleTextAttributes:forState:]` successfully changes the text style for me. Are you saying you want each individual tab's text style to be different? – hgwhittle Sep 16 '13 at 15:51
  • Yes. But your method doesn't work for me. I dont know why. – dpart Sep 16 '13 at 16:09
  • http://stackoverflow.com/questions/6051706/uitabbaritem-with-custom-title-color-and-images You can use this. – Vinay Jain Nov 22 '13 at 11:26

1 Answers1

0

Use image if you want to accomplish this without that it is not possible read every UITabBarItem separately then use image for every one

UITabBarController *tabBarController=(UITabBarController*)self.window.rootViewController;

UITabBar *tabBar=tabBarController.tabBar;

UITabBarItem *tabBarItemClassic=[tabBar.items objectAtIndex:0];

UITabBarItem *tabBarItemAdvance=[tabBar.items objectAtIndex:1];

UITabBarItem *tabBarItemMore=[tabBar.items objectAtIndex:2];

now lets say i want to use different color for tabBarItemMore.

you can title to nil and can use custom designed image to be displayed there.

In my following case i am not using title i am using image which have title written below the icon.

[tabBarItemMore setImage:[[UIImage imageNamed:@"more.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

    [tabBarItemMore  setSelectedImage:[[UIImage imageNamed:@"more.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
Husrat Mehmood
  • 2,270
  • 1
  • 20
  • 22