我正试图复制UITabBarItem上使用的原始字体设置,以便在自定义选项卡上使用。
有人知道字体设置是什么吗?什么UIFont、字体大小、文本颜色等。。。?
我使用下面的设置来复制本机字体:
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的答案,在Swift(以及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)