UIBarButtonItem setBackgroundImage在iOS7 iPad中不再有效 [英] UIBarButtonItem setBackgroundImage not working anymore in iOS7 iPad

查看:120
本文介绍了UIBarButtonItem setBackgroundImage在iOS7 iPad中不再有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个外观相关的代码在iOS 5中工作正常:

I have this appearance related code that was working fine in iOS 5:

-(void)customizeBackButton:(UIBarButtonItem*)backButtonItem {;
    [backButtonItem setBackgroundImage:[UIImage imageNamed:@"backbuttonitem"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}

此方法在 viewDidLoad 正常 UIViewController

Backbutton是一个UIBarButtonItem的连接IBOutlet,放在UIToolbar中,我正在调试时正确看到它。关键是我可以改变色调和其他外观,但不能改变背景图像。

Backbutton is a connected IBOutlet of a UIBarButtonItem, placed in a UIToolbar, and I am correctly seeing it when debugging. The point is that I can change tint and other appearances, but not the background images.

该代码在iPhone中运行良好(它是一款通用应用程序),并且在iPad + iOS 5中运行良好。

The code is working fine in iPhone (it's a universal app), and was working fine in iPad+iOS 5.

我做错了什么或者是否有关于UIBarButtonItem的错误?

Am I doing something wrong or is there some kind of bug about UIBarButtonItem ?

此代码在我的应用程序中随处可用,因为我已经替换了默认的UINavigationBar按钮到正常的UIBarButtonItem,因为我需要在弹出控制器之前调用一些检查操作。

This code is used everywhere in my app, because I have replaced default UINavigationBar back button to a normal UIBarButtonItem, because I needed to call some checking action before popping the controller.

推荐答案

尝试使用新的API [UINavigationBar backIndicatorImage:backIndicatorImage]

Try using the new API [UINavigationBar backIndicatorImage:backIndicatorImage].

记录此处

这篇关于UIBarButtonItem setBackgroundImage在iOS7 iPad中不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆