更改uinavigationcontroller上后退按钮的字体

更改uinavigationcontroller上后退按钮的字体

本文介绍了更改uinavigationcontroller上后退按钮的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

  [[UIBarButtonItem外观] 

我试图改变我的后退按钮上的文本的字体颜色UINavigationControllerBar ] setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

给我这个错误:[_UIBarItemAppearance setTitleColor:forState:]:无法识别的选择器发送到实例0x69aeb70' / p>

有什么帮助吗?谢谢!

解决方案

使用这个,而不是在iOS 5中可用的默认功能

  UIBarButtonItem * backbutton = [[UIBarButtonItem alloc] initWithTitle:@backstyle:UIBarButtonItemStyleBordered target:nil action:nil]; 

[backbutton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor],UITextAttributeTextColor,[UIFont fontWithName:TEXTFONT size:16.0f],UITextAttributeFont,
nil] forState:UIControlStateNormal] ;


I'm trying to change the font color of the text on my back button in my UINavigationControllerBar

    [[UIBarButtonItem appearance] setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

gives me this error: [_UIBarItemAppearance setTitleColor:forState:]: unrecognized selector sent to instance 0x69aeb70'

Any help? Thanks!

解决方案

Use this instead, default function available in ios 5

UIBarButtonItem *backbutton =  [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStyleBordered target:nil action:nil];

    [backbutton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIColor blackColor],UITextAttributeTextColor,[UIFont fontWithName:TEXTFONT size:16.0f],UITextAttributeFont,
                                                   nil] forState:UIControlStateNormal];

这篇关于更改uinavigationcontroller上后退按钮的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:59