我如何给出一个"标识符"到我的故事板中的视图控制器?

时间:2013-03-18 13:47:00

标签: ios objective-c xcode uiviewcontroller storyboard

instantiateViewControllerWithIdentifier:方法要求我传递的视图控制器具有标识符。我去了我的故事板并点击了我的视图控制器,但我看不到设置标识符的选项。我在哪里找到这个选项?

3 个答案:

答案 0 :(得分:52)

正如图片所暗示的那样!希望它有所帮助!

enter image description here

然后使用它,你打电话:

[self.storyboard instantiateViewControllerWithIdentifier:@"YourViewControllerID"];

答案 1 :(得分:9)

针对XCode 8和Swift 3进行了更新。

instantiateViewControllerWithIdentifier现在是 instantiateViewController(withIdentifier:)

设置故事板ID: enter image description here

答案 2 :(得分:5)

身份检查器中,有一个字段 Storyboard ID 。您可以在此输入类名,然后在instantiateViewControllerWithIdentifier:中使用此标识符。

相关问题