【问题标题】:instantiateViewControllerWithIdentifier, but where is the identifier in xCode 4.5?instantiateViewControllerWithIdentifier,但是 xCode 4.5 中的标识符在哪里?
【发布时间】:2012-10-09 05:28:25
【问题描述】:

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

我读到我可以使用情节提要中的 instantiateViewControllerWithIdentifier 方法,但是如何找到我的视图控制器的 ID?我尝试查看情节提要的 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];
}

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

谢谢!

【问题讨论】:

    标签: ios xcode4.5


    【解决方案1】:

    它位于 IB 的 Identity Inspector 选项卡下。它被称为“故事板 ID”。你可以给它任何你想要的唯一名称。

    【讨论】:

      猜你喜欢
      • 2017-02-15
      • 2011-04-13
      • 2011-11-14
      • 1970-01-01
      • 2014-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多