Search code examples
objective-cuitabbaruiappearanceios7xcode5

'[UITabBar appearance] setTitle' - Doesn't work in Xcode 5, iOS 7


Xcode 5 is not even familiar with setTitle to UITabBar, the error is:

No visible @interface for 'UITabBar' declares the selector 'setTitle:

Looking for UITabBar in: http://developer.apple.com/library/ios/navigation/ doesn't show any changes in edition. Whats going on here?

EDIT:

Original code is:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        [[UITabBar appearance] setBackgroundImage:[[UIImage alloc]init]];
        [[UITabBar appearance] setSelectionIndicatorImage:[[UIImage alloc]init]];
        [[UITabBar appearance] setTitle:NSLocalizedString(@"home", nil)];
    }
    return self;
}

Solution

  • UITabBar does not allow setting the title via UIAppearance. In general, no UI elements allow setting a title in this way. As a rule, UIAppearance is only for managing the styling of your application, not the content. See this list for reference.