gpt4 book ai didi

ios - 识别 UIStoryboard

转载 作者:可可西里 更新时间:2023-11-01 03:57:17 24 4
gpt4 key购买 nike

如何识别 UIStoryboard?

该类具有创建和实例化的方法,但我没有看到带有类似name 的@property。例如

获取 Storyboard对象

+ storyboardWithName:bundle:

实例化 Storyboard View Controller

– instantiateInitialViewController
– instantiateViewControllerWithIdentifier:

有什么建议吗?

====更新

我希望得到像 self.storyboard.name[self.storyboard description] 这样的东西,例如:

NSLog(@"This Storyboard is: %@", self.storyboard.name);

也许这不是命中注定的。

最佳答案

您可以在项目导航器中通过名称识别 Storyboard:

enter image description here

您可以通过在界面构建器的身份检查器中设置 Storyboard ID,从 Storyboard中识别 View Controller :

enter image description here

一旦你有了这些,你就可以通过你的代码访问它们:

UIStoryboard *iPhoneStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
ViewController *firstViewController = [iPhoneStoryboard instantiateViewControllerWithIdentifier:@"FirstViewController"];

关于ios - 识别 UIStoryboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16061624/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com