我有一个工具栏在我的故事板,并希望改变颜色和Delea的来源。使用下面的代码,我可以更改颜色,但字体不会改变。怎么了?我的消息来源应该是“接近新大陆”
- (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;
}这是我的工具栏:

发布于 2015-08-06 17:06:59
主要问题是您正在使用键NSForegroundColorAttributeName并将其设置为字体,而您应该使用NSFontAttributeName。
NSDictionary *attributes = @{NSFontAttributeName : [UIFont fontWithName:@"ProximaNova-Bold" size:17.0]};https://stackoverflow.com/questions/31861701
复制相似问题