gpt4 book ai didi

ios - UIStoryboard loadNibNamed模拟方法

转载 作者:行者123 更新时间:2023-11-29 10:52:52 26 4
gpt4 key购买 nike

我使用本教程来实现我的自定义 UITabBarController:link

但我使用的是 Storyboard而不是 xibs。所以一些方法使用下面的代码:

NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"TabBarView" owner:self options:nil];

这对 xib 是公平的,但我认为对 Storyboard来说不公平。

最佳答案

这对你有用

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardName" bundle:nil];
UIViewController *initViewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewControllerName"];

不要忘记在 Storyboard中为您的 View Controller 提供标识符。

注意:- 确保您在 Storyboard中提供了 ViewControllerWithIdentifier

关于ios - UIStoryboard loadNibNamed模拟方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19680891/

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