【问题标题】:where to get identifier for instantiateViewControllerWithIdentifier [duplicate]在哪里获取 instanceViewControllerWithIdentifier 的标识符 [重复]
【发布时间】:2014-09-14 01:23:35
【问题描述】:

假设我在情节提要similar to this SO question 中创建了所有视图。对于方法

SomeController *myController = [self.storyboard 
  instantiateViewControllerWithIdentifier:@"yourIdentifier"];

我在情节提要中的何处获取/设置“yourIdentifier”?在Identity inspector > Identity 下有两个选项:Storyboard IDRestoration ID。但根据 instantiateViewControllerWithIdentifier 方法的文档,似乎都不是答案。

【问题讨论】:

  • 这是故事板 ID;恢复 ID 用于其他用途。

标签: ios objective-c xcode uiviewcontroller storyboard


【解决方案1】:

您需要使用 StoryBoard ID。

您可以在情节提要中给出它,如图所示。

然后用这个id作为

SomeController *myController =  [self.storyboard 
  instantiateViewControllerWithIdentifier:@"ViewController"];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-13
    • 2017-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多