我使用本教程实现我的自定义UITabBarController:链接
但我用的是故事板而不是西布斯。因此,有些方法使用下面的代码:
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"TabBarView" owner:self options:nil];这对xib来说是公平的,但我认为对故事板是不公平的。
发布于 2013-10-30 11:28:14
这对你来说很管用
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardName" bundle:nil];
UIViewController *initViewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewControllerName"];不要忘记在故事板中给你的视图控制器提供标识符。
注意:-确保您在故事板中给出了ViewControllerWithIdentifier。
发布于 2013-10-30 11:51:24
恐怕故事板不太适合这种任务。没有从UIStoryboard实例获取特定视图的方法。
在这种情况下,我建议您创建一个单独的xib文件,它只包含您想要自己加载的视图,并使用您给出的代码加载它。
另外,我也不建议使用自上次提交以来已有3年的库,特别是使用iOS 7,它打破了很多东西。
https://stackoverflow.com/questions/19680891
复制相似问题