我正尝试在选项卡栏中使用新的情节提要引用。当我使用故事板引用时,UITabBarItem (具有自定义的图像和文本集)没有显示任何内容。请参阅设置:storyboard setup
我现在通过在initWithCoder函数中为引用的故事板中的初始视图控制器设置图像和标题来修复它,如下所示:
static NSString *const ContactsViewControllerTabContactImageName = @"tab-contact";
static NSString *const ContactsViewControllerTabContactActiveImageName = @"tab-contact-active";
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
self.title = NSLocalizedString(@"Contacts", nil);
self.tabBarItem.image = [UIImage imageNamed:ContactsViewControllerTabContactImageName];
self.tabBarItem.selectedImage = [UIImage imageNamed:ContactsViewControllerTabContactActiveImageName];
}
return self;
}
发布于 2015-11-17 18:29:32
你可以像下面这样获取故事板的参考
UIStoryboard *mainStoryboard = UIStoryboard storyboardWithName:@"MainStoryboard“捆绑包: nil;
https://stackoverflow.com/questions/33754320
复制相似问题