问题描述
||
我正在尝试复制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)