【问题标题】:How to perform segue to a nib from storyboard如何从情节提要对笔尖进行转场
【发布时间】:2012-08-23 00:19:53
【问题描述】:

我当前项目的 90% 都是在情节提要中完成的,但我也使用单个 xib 视图控制器来实现“输入您的 pin”视图,因为这是将它集成到我导入到项目中的 github 项目中的方式.我需要从 xib 回到故事板。使用 push 方法从情节提要到 xib 很容易,但现在我想模态到情节提要中的另一个视图。有什么建议么?首先,我尝试将 xib 转换为情节提要中的视图,但失败了,因为它是为使用 nib 而设计的。

【问题讨论】:

    标签: objective-c ios storyboard nib


    【解决方案1】:

    您可以通过调用它的实例化方法在情节提要上创建任何视图控制器的新实例。

    所以做一些类似的事情:

    [storyboard instantiateViewControllerWithIdentifier:@"identifier"];
    

    【讨论】:

      【解决方案2】:

      首先从情节提要中获取您需要的 ViewController(因此您需要在情节提要中为视图控制器设置标识符

      ViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"identifier"];
      

      然后转到这个控制器

      [self presentModalViewController:vc animated:YES]; 
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-12-25
        • 2015-02-14
        • 1970-01-01
        • 2020-04-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-16
        相关资源
        最近更新 更多