在我的应用程序中,我想在导航栏中同时显示后退按钮的按钮项。我阅读了UINavigationItem类的文档,发现属性leftItemsSupplementBackButton似乎只适合我。然后,我使用了以下代码行:

- (void)viewDidLoad{
  [super viewDidLoad];
  [self.navigationItem setLeftItemsSupplementBackButton:YES];
}

但是,当我运行该应用程序时,出现此错误:
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationItem setLeftItemsSupplementBackButton:]: unrecognized selector sent to instance 0x10faefb0'

0x10faefb0实例是:
_navigationItem UINavigationItem *  0x10faefb0

从错误看来,self.navigationItem不具有the apple class reference中所说的此属性。我哪里错了?

最佳答案

仅适用于iOS 5。您在iOS 4上运行吗?

关于objective-c - 使用UINavigationItem类的属性leftItemsSupplementBackButton,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8211266/

10-13 08:24