如何找到实例化的当前 View Controller 的标识符?
例子:
self.storyboard?.instantiateViewControllerWithIdentifier("ThisViewController") as! UIPageViewController
然后使用类似self.storyboard?.currentViewControllerIdentifier
的东西来返回ThisViewController
?
最佳答案
来自 UIStoryboard 的文档:
This identifier is not a property of the view controller object itself and is used only by the storyboard file to locate the view controller.
所以简短的回答是你不能。更长的答案是您可以子类化 UIViewController 并为标识符添加一个属性,并在每次从 Storyboard加载时分配该属性。
关于ios - 返回 Storyboard当前 View Controller 标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31059082/