UIBarButtonItem setTintColor在iOS7上不起作用

UIBarButtonItem setTintColor在iOS7上不起作用,第1张

概述在iOS6中,我使用此代码来创建我的UIBarButtonItem: UIBarButtonItem* validate = [[UIBarButtonItem alloc]initWithTitle:@"MyTitle" style:UIBarButtonItemStylePlain target:self action:@selector(actionValidate)]; [vali 在iOS6中,我使用此代码来创建我的UIbarbuttonItem:

UIbarbuttonItem* valIDate = [[UIbarbuttonItem alloc]initWithTitle:@"MyTitle" style:UIbarbuttonItemStylePlain target:self action:@selector(actionValIDate)];    [valIDate setTintcolor:[UIcolor orangecolor]];    self.navigationItem.rightbarbuttonItem = valIDate;

它在iOS6中运行良好,但在iOS7中,按钮的颜色只有在你推动时才会改变.我该如何解决这个问题?

解决方法 在iOS7中,如果需要更改navigationbar按钮颜色,则必须为navgationbar设置tintcolor,而不是为特定的barbutton设置tintcolor.

navigationController.navigationbar.tintcolor = [UIcolor orangecolor];

编辑:这适用于iOS7,您需要进行检查:

float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];if (systemVersion >= 7.0){    navigationController.navigationbar.tintcolor = [UIcolor orangecolor]}
总结

以上是内存溢出为你收集整理的UIBarButtonItem setTintColor在iOS7上不起作用全部内容,希望文章能够帮你解决UIBarButtonItem setTintColor在iOS7上不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1018511.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存