UItabbar项目未显示故事板参考 [英] UItabbar item not showing storyboard reference

查看:86
本文介绍了UItabbar项目未显示故事板参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在标签栏中使用新的故事板参考。当我使用故事板参考时,UITabBarItem(带有自定义图像和文本集)没有显示任何内容。请参阅设置:


I'm trying to use the new storyboard references in a tabbar. When I use the storyboard reference, the UITabBarItem (with customized image & text set), isn't showing anything. See setup: storyboard setup

tabbaritem setup

I fixed it for now by setting the images & title in the initWithCoder function for the initial viewcontroller in the referenced storyboards like so:

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

解决方案

You need to add the tab bar item in the destination storyboard view controller.

这篇关于UItabbar项目未显示故事板参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆