ios - instantiateViewControllerWithIdentifier,但 xCode 4.5 中的标识符在哪里?

标签 ios xcode4.5

我有一个带有书名的 UITableView。我还有一个 View (AddAndEditBookViewController) 来输入有关书籍的信息。当我单击表格导航栏上的“+”时,我想打开我的 AddAndEditBookViewController。如果我在一个单独的 nib 文件中创建表,我知道该怎么做,但是如果我的 View 是在 Storyboard 中创建的(没有 segues ...更多用于此时的学习目的),我该怎么做。

我读到我可以使用 Storyboard 中的 instantiateViewControllerWithIdentifier 方法,但是如何找到我的 View Controller 的 ID?我尝试查看 Storyboard 的 XML 表示,但我似乎没有找到它...

下面是尝试打开模态视图的代码。

- (void)insertNewObject:(id)sender
{
    AddAndEditBooksViewController * addViewController = (AddAndEditBooksViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"gH8-2m-MXv"];
    [addViewController setDelegate:self];
    [addViewController setModalPresentationStyle:UIModalPresentationFormSheet];
    [self presentViewController:addViewController animated:YES completion:NULL];
}

我的具体问题是:我应该使用什么标识符?在哪里指定或如何手动指定?

谢谢!

最佳答案

它位于 IB 中的身份检查器选项卡下。它被称为“ Storyboard ID”。您可以为其指定任何您想要的唯一名称。

关于ios - instantiateViewControllerWithIdentifier,但 xCode 4.5 中的标识符在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12793337/

相关文章:

cocoa-touch - 使用 loadNibNamed 时未初始化子类 UITableViewCell

objective-c - 从父对象引用嵌套对象

ios - dismissModalViewControllerAnimated 不释放 View Controller

ios - 不能将 .ttf 字体包含到项目中

uitableview - iOS Storyboard: set a background color to prototype cell

objective-c - 自动检测 iOS/OS X 和 XCode 4.5 中已弃用的 SDK 方法?

iphone - 在 UIAlertView 中向下移动按钮

ios - 在 swift 4 IOS 应用程序中手动添加和引用控件

xcode4.5 - 在选择或单个文件中查找和替换 - Xcode 4.5

xcode - 默认情况下,在 Xcode 中让文件成为多个目标的一部分