首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改工具栏颜色和字体IOS 9

更改工具栏颜色和字体IOS 9
EN

Stack Overflow用户
提问于 2015-08-06 17:02:56
回答 1查看 341关注 0票数 1

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

代码语言:javascript
复制
- (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;

}

这是我的工具栏:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-06 17:06:59

主要问题是您正在使用键NSForegroundColorAttributeName并将其设置为字体,而您应该使用NSFontAttributeName

代码语言:javascript
复制
NSDictionary *attributes = @{NSFontAttributeName : [UIFont fontWithName:@"ProximaNova-Bold" size:17.0]};
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31861701

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档