【问题标题】:SWRevealViewController - push next view controller storyboardSWRevealViewController - 推送下一个视图控制器故事板
【发布时间】:2014-10-22 11:11:29
【问题描述】:

我有一个用 SWRevealViewController 制作的侧边栏菜单。

我想从视图控制器和带有按钮的视图切换到下一个视图控制器。我该怎么做? 我尝试使用 ACTION SEGUE:“push”、“modal”、“revealview controller”和“revealview controller push controller”。

但它不起作用。

我尝试以编程方式切换到下一个视图控制器。 我的代码:

ViewController2 *vc2 = [[ViewController2 alloc] init];
[self.navigationcontroller pushViewController:vc2 animated:YES]

这改变了 ViewController,但没有视图(黑屏)。

【问题讨论】:

    标签: ios objective-c iphone


    【解决方案1】:

    看来 ViewController2 是情节提要中的 ViewController。试试下面的代码:

    ViewController2 * vc2 = [[self storyboard] instantiateViewControllerWithIdentifier:@"ViewControllerId"];
    

    您应该在情节提要中将 ViewController2 的情节提要 ID 作为 ViewControllerId 提供。

    请注意,您当前的 ViewController 应该在 Navigationcontroller 堆栈中以调用 self.navigationcontroller。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-01
      • 2014-06-30
      • 2013-05-24
      • 2015-09-24
      • 1970-01-01
      • 1970-01-01
      • 2015-09-07
      相关资源
      最近更新 更多