1

Like a lot of developers I am playing around with the new features of IOS 5.

I tried to use appearance proxy's for customizing my App. But at some methods I get an error.

This works:

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

But when I try:

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

I get an unrecognized selector error:

-[_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) 

Any ideas ?

Justin
  • 2,960
  • 2
  • 34
  • 48

1 Answers1

1

The method has a different name, you're missing a part of it. Since iOS 5 is still under NDA, I won't cite or link the method name here, but you can look it up yourself:

  • Go to the iOS Dev Center.
  • Select iOS SDK GM Seed.
  • Select iOS Developer Library.
  • In the search field, start typing UINavigationBar.
  • Click on the UINavigationBar Class Reference link.
  • Read the documentation.
DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • Still in NDA.. ok. Thanks that worked. I thought they had all the same methods. – Justin Oct 09 '11 at 10:11
  • The NDA is only lifted once the major version in question (here: 5) is released to the public which this time will be 2011-10-12 according to the *Let's talk iPhone* event from last Tuesday. – DarkDust Oct 09 '11 at 10:15
  • 5
    Here's the link for the UINavigationBar class reference for others annoyed by this answer in 2012 -- err, 2013. https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UINavigationBar_Class/Reference/UINavigationBar.html – Danny Jan 03 '13 at 00:18