![](/img/trans.png)
[英]How can I substitute the UITabBar of UITabBarController programmatically
[英]iOS/xcode - How can I open a new storyboard from UITabBarController and keep the UITabBar from disappearing?
我一直在努力从单个UITabBarController
链接多个故事板。 我在可以打开新的故事板并显示初始UIViewController
,只是在打开新的故事板时UITabBar
消失了。
这是我用来切换到新故事板的代码:
-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
if ( [viewController isMemberOfClass:[ProfileRedirectViewController class]] )
{
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Profile" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"ProfileTableViewController"];
[self.view.window.rootViewController presentViewController:vc animated:YES completion:nil];
//[self.navigationController pushViewController:vc animated:false];
return NO;
}
return YES;
}
我一直在使用navigationController
版本,但是它什么也没做,导致单击无效,并且日志中没有错误。 我一直在寻找一个答案,也许我已经走了一些错误的道路。 我是xcode的新手,所以我很可能会丢失一些明显的内容或使用古怪的搜索条件来寻求帮助。
当我们导航到主故事板中的任何其他视图时,只有当我移到下一个故事板时,我们才会丢失UITabBar
。
非常感谢所有帮助!
您正在告诉视图窗口加载新的根目录,但是您想要做的是让UIBarTab打开另一个情节提要。 看一下他的帖子,有一个很好的详细答案: 通过UITabBarController打开新故事板的正确方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.