where to get identifier for instantiateViewControllerWithIdentifier [duplicate]

烂漫一生 提交于 2019-12-12 06:39:11

问题


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

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

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.


回答1:


You need to use a StoryBoard ID.

You can give it in storyboard as in image shown.

Then use this id as

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


来源:https://stackoverflow.com/questions/24900668/where-to-get-identifier-for-instantiateviewcontrollerwithidentifier

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!