![](/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.