【问题标题】:programmatically access UIViewController identifier [duplicate]以编程方式访问 UIViewController 标识符 [重复]
【发布时间】:2013-12-12 09:25:00
【问题描述】:

我有一个基础UIViewController,我使用情节提要从我的应用程序中继承了一些基本内容。

我这样实例化它:

BasicContentViewController *targetController = [self.storyboard instantiateViewControllerWithIdentifier:@"ColorCouture"];
        [self.navigationController pushFadeViewController:targetController];

 BasicContentViewController *targetController = [self.storyboard instantiateViewControllerWithIdentifier:@"Hospitality"];
        [self.navigationController pushFadeViewController:targetController];

有没有办法让我检查我用来实例化UIViewControllers 的标识符?

我想确保我不会将超过 1 个这些控制器推入我的 UIViewController 堆栈

【问题讨论】:

  • 我不确定你在问什么。您确实拥有标识符,因为您使用它们来实例化您的视图控制器。你到底想检查什么?
  • appears 答案是否定的。
  • 实际上,如果您进一步阅读,您可以使用 restoreId,它非常适合我。

标签: ios objective-c cocoa-touch uistoryboard


【解决方案1】:

这个问题解决了我的问题:

Programmatically get a Storyboard ID?

我只是使用 restoreId 代替,效果很好。

【讨论】:

    猜你喜欢
    • 2012-07-28
    • 2016-12-11
    • 1970-01-01
    • 2015-02-26
    • 2013-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多