以编程方式获取故事板ID?

以编程方式获取故事板ID?

问题描述:

尝试查看UIViewController或UIView是否可以识别其Storyboard ID。所以希望:

Trying to see if a UIViewController or UIView can identify its Storyboard ID. So was hoping for:

UIViewController *aViewController;
NSString *storyboardID = aViewController.storyboard.id;  //not an actual property

或:

NSString *storyboardID = [aViewController.storyboard valueForKey:@"storyboardId"];  //also not a working call

但没有快乐,也无法在网上找到类似的解决方案。有没有人知道这是否可能?

But no joy and couldn't find a similar solution online. Does anyone know if this is even possible?

您可以使用restorationIdentifier,它位于Storyboard标识符的正上方,它是一个UIViewController物业。

You can use the restorationIdentifier, it's right above the Storyboard identifier and it's a UIViewController property.