簡體   English   中英

為什么一個故事板包含一個UITabBarController不能顯示另一個故事板/

[英]Why a storyboard contain a UITabBarController can't present another storyboard/

有關的代碼提供了另一個獨立的故事板,如下所示:

- (IBAction)action:(id)sender {

UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil];
UIViewController *firstVC = [secondStoryboard instantiateViewControllerWithIdentifier:@"22"];
[self.navigationController presentViewController:firstVC animated:YES completion:nil];
}

如果我的后續故事板包含一個UITabBarController的Pesentbutton,其功能為-(IBAction)action:(id)sender; 無法呈現另一個獨立的故事板。

在此處輸入圖片說明

如果我的以下故事板包含一個UINavigationController該Pesentbutton具有-(IBAction)action:(id)sender; 按預期呈現另一個獨立的故事板。

在此處輸入圖片說明

誰能告訴我原因呢?謝謝!

因為在第一種情況下, self.navigationController為nil ...因為不存在導航控制器。 嘗試從selfself.tabBarController呈現

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM