IOS 5无法识别的select器在外观代理发送setBackgroundImage

就像很多开发者一样,我正在玩iOS 5的新function。

我试图使用外观代理来定制我的应用程序。 但在某些方法中,我得到一个错误。

这工作:

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent]; //and [[UINavigationBar appearance] setTintColor:[UIColor greenColor]]; 

但是当我尝试:

 [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"toolbar_background.png"]]; 

我得到一个无法识别的select器错误:

 -[_UIAppearance setBackgroundImage:]: unrecognized selector sent to instance 0x153020 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIAppearance setBackgroundImage:]: unrecognized selector sent to instance 0x153020' *** First throw call stack: (0x3107a8bf 0x3821f1e5 0x3107dacb 0x3107c945 0x30fd7680 0x2fe7 0x3304c7eb 0x330463bd 0x33014921 0x330143bf 0x33013d2d 0x33bffe13 0x3104e553 0x3104e4f5 0x3104d343 0x30fd04dd 0x30fd03a5 0x33045457 0x33042743 0x2f31 0x2ec8) terminate called throwing an exception(gdb) 

有任何想法吗 ?

该方法有一个不同的名称,你错过了一部分。 由于iOS 5仍然处于NDA之下,因此我不会在这里引用或链接方法名称,但您可以自己查看:

  • 转到iOS开发中心 。
  • selectiOS SDK GM种子
  • selectiOS开发人员库
  • 在search字段中,开始inputUINavigationBar
  • 点击UINavigationBar类参考链接。
  • 阅读文档。