ios 如何在故事板中为视图控制器提供“标识符”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15478411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I give an "identifier" to a view controller within my storyboard?
提问by Doug Smith
The instantiateViewControllerWithIdentifier:
method requires that the view controller I pass have an identifier. I went to my storyboard and clicked on my view controller, but I see no option to set the identifier. Where exactly do I find this option?
该instantiateViewControllerWithIdentifier:
方法要求我传递的视图控制器具有标识符。我转到我的故事板并单击我的视图控制器,但我看不到设置标识符的选项。我在哪里可以找到这个选项?
回答by Groot
As the Image suggests! Hope it helps!
如图所示!希望能帮助到你!
Then to use it you call:
然后使用它你调用:
[self.storyboard instantiateViewControllerWithIdentifier:@"YourViewControllerID"];
回答by Taiwosam
回答by Felix
In the identity inspectorthere is a field Storyboard ID. You could enter the class name here and then use this identifier in instantiateViewControllerWithIdentifier:
.
在身份检查器中有一个字段Storyboard ID。您可以在此处输入类名,然后在instantiateViewControllerWithIdentifier:
.