从哪里获取instantiateViewControllerWithIdentifier 的标识符 [英] where to get identifier for instantiateViewControllerWithIdentifier

查看:48
本文介绍了从哪里获取instantiateViewControllerWithIdentifier 的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在故事板中创建了所有视图,类似于这个 SO 问题.对于方法

Suppose I create all my views in the storyboard, similar to this SO question. For the method

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

我在哪里可以在故事板中获取/设置yourIdentifier"?在 Identity inspector > 下Identity 有两个选项:Storyboard IDRestoration ID.但是根据方法 instantiateViewControllerWithIdentifier 的文档似乎都不是答案.

where do I get/set "yourIdentifier" in the storyboard? Under Identity inspector > Identity are two options: Storyboard ID and Restoration ID. But per the document for the method instantiateViewControllerWithIdentifier neither seems to be the answer.

推荐答案

您需要使用 StoryBoard ID.

You need to use a StoryBoard ID.

您可以在故事板中提供它,如图所示.

You can give it in storyboard as in image shown.

然后使用这个id作为

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

这篇关于从哪里获取instantiateViewControllerWithIdentifier 的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆