我的应用程序使用自定义字体,我使用UIAppearance代理来实现此目的:
appearance = @{NSFontAttributename: [UIFont FontWithname:@"ProximaNova-Regular" size:18.0]};[[UIbarbuttonItem appearance] setTitleTextAttributes:appearance forState:UIControlStatenormal];
麻烦的是,外观代理使Plain和Done样式按钮成为我上面指定的常规重量字体.
任何想法如何让UIbarbuttonItem根据样式使用不同的自定义字体权重?
解决方法 我知道这是迟到的答案,但它对某些人有帮助:UIbarbuttonItem *custombarbutton = [[UIbarbuttonItem alloc] initWithTitle:NSLocalizedString(@"CustomTitle",@"This button appears in my smexy VIEwController's naviagtion bar") style:UIbarbuttonItemStylePlain target:self action:@selector(custombuttonDIDClick:)]; NSDictionary *attributes = @{NSFontAttributename: [UIFont FontWithname:@"TimesNewRomanPS-BoldMT" size:14.0f],NSForegroundcolorAttributename: [UIcolor redcolor]}; // here you can add some other keys (especially in iOS 7) to personalize your button Title more [custombarbutton setTitleTextAttributes:attributes forState:UIControlStatenormal]; [self.navigationItem setRightbarbuttonItem:custombarbutton];
编辑:感谢您检测我的拼写错误:-)
总结以上是内存溢出为你收集整理的在iOS7中,使用UIAppearance代理时,UIBarButtonItems不尊重粗体“完成”样式全部内容,希望文章能够帮你解决在iOS7中,使用UIAppearance代理时,UIBarButtonItems不尊重粗体“完成”样式所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)