【问题标题】:Why a storyboard contain a UITabBarController can't present another storyboard/为什么故事板包含 UITabBarController 不能呈现另一个故事板/
【发布时间】:2014-05-16 04:10:43
【问题描述】:

展示另一个独立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,则功能为-(IBAction)action:(id)sender; 的Pesentbutton 无法呈现另一个独立的故事板。

如果我的故事板(如关注)包含UINavigationController,则功能为-(IBAction)action:(id)sender; 的Pesentbutton 按预期呈现另一个独立的故事板。

谁能告诉我原因?多谢!

【问题讨论】:

    标签: ios objective-c uinavigationcontroller uitabbarcontroller uistoryboard


    【解决方案1】:

    因为在第一种情况下self.navigationController 为零...因为不存在导航控制器。尝试从selfself.tabBarController 进行演示

    【讨论】:

      猜你喜欢
      • 2012-01-29
      • 1970-01-01
      • 2012-02-13
      • 2013-09-17
      • 2014-11-13
      • 2020-08-05
      • 1970-01-01
      • 2017-02-22
      • 2018-12-12
      相关资源
      最近更新 更多