4

I'm trying to duplicate the naive font settings used on a UITabBarItem for use on a custom tabbar.

Does anyone know what the font settings are? What UIFont, font size, text color, etc...?

cpjolicoeur
  • 12,766
  • 7
  • 48
  • 59

2 Answers2

9

I used the settings below to replicate the native font:

UILabel* tabBarItemLabel = [[[UILabel alloc] init] autorelease];
tabBarItemLabel.font = [UIFont boldSystemFontOfSize:10];
tabBarItemLabel.textColor = [UIColor colorWithRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1];
tabBarItemLabel.shadowColor = [UIColor clearColor];
tabBarItemLabel.backgroundColor = [UIColor clearColor];
dessy
  • 136
  • 1
  • 7
0

dessy's answer, in Swift (and for iOS 8):

    self.versionLabel = UILabel()   
    self.versionLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
    self.versionLabel.text = "Some string"
    self.versionLabel.font = UIFont.systemFontOfSize(10.0)
    self.versionLabel.textColor = UIColor(red: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 1.0)
Bart van Kuik
  • 4,704
  • 1
  • 33
  • 57