[英]change toollbar color and font IOS 9
I have a toolbar on my storyboard and want to change the color and Delea source. 我的情节提要板上有一个工具栏,想要更改颜色和Delea源。 With the code below I adciocei I can change the color but the font does not change. 使用下面的代码adciocei,我可以更改颜色,但字体不会更改。 What's wrong? 怎么了? My source should be "proximaNova-Bold" 我的来源应该是“ proximaNova-Bold”
- (void)viewDidLoad {
[super viewDidLoad];
[self registerCellNamed:@"DeviceLostHeaderCell"];
[self registerCellNamed:@"DeviceLostDescriptionCell"];
[self registerCellNamed:@"DeviceLostPhotoCell"];
NSDictionary *attributes = @{NSForegroundColorAttributeName : [UIColor colorWithRed:82/255.0 green:157/255.0 blue:230/255.0 alpha:1.0], NSForegroundColorAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:17.0]};
NSDictionary *attributes2 = @{NSForegroundColorAttributeName : [UIColor redColor], NSForegroundColorAttributeName : [UIFont fontWithName:@"proximaNova-Regular" size:17.0]};
[self.rigthToolbarItem setTitleTextAttributes:attributes
forState:UIControlStateNormal];
[self.leftTollbarItem setTitleTextAttributes:attributes2
forState:UIControlStateNormal];
self.dataTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
this is my toolbar: 这是我的工具栏:
主要问题是您正在使用键NSForegroundColorAttributeName
并将其设置为字体,而应该使用NSFontAttributeName
。
NSDictionary *attributes = @{NSFontAttributeName : [UIFont fontWithName:@"ProximaNova-Bold" size:17.0]};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.