我正在尝试自定义导航栏及其 AppDelegate 文件中的按钮:
// first I am customizing the done button
[[UIBarButtonItem appearance] setBackgroundImage:buttonDone forState:UIControlStateNormal style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackgroundImage:buttonDonePressed forState:UIControlStateHighlighted style:UIBarButtonItemStyleDone barMetrics:UIBarMetricsDefault];
//and then I am customizing the back button
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBack forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBackPressed forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
我正在[_UIBarItemAppearance setBackgroundImage:]: unrecognized selector sent to instance
等待完成按钮。奇怪的是,后退按钮的自定义有效,而完成按钮的自定义使应用程序崩溃。任何想法为什么?
* PS buttonDone、buttonDonePressed、buttonBack 和 buttonBackPressed 是我创建的四个 UIImage-s *
更新:在 iOS 5.0 模拟器上,应用程序崩溃,但在 6.0 上它可以工作。关于我可以做些什么来避免 5.0 崩溃的任何建议?