以编程方式获取故事板ID? [英] Programmatically get a Storyboard ID?

查看:140
本文介绍了以编程方式获取故事板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.

这篇关于以编程方式获取故事板ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆