1

Xcode 5 甚至不熟悉setTitleto UITabBar,错误是:

'UITabBar' 没有可见的@interface 声明选择器'setTitle:

寻找UITabBar: http: //developer.apple.com/library/ios/navigation/没有显示版本的任何变化。这里发生了什么?

编辑:

原始代码是:

- (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;
}
4

1 回答 1

6

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.

于 2013-07-02T12:30:17.997 回答