使用故事板 ioS5 时从视图控制器移动到选项卡栏控制器

发布于 2024-12-11 14:01:48 字数 226 浏览 1 评论 0原文

我在故事板中创建了一个工作完美的选项卡栏控制器。现在我需要从视图控制器移动到此选项卡栏控制器。我没有为选项卡栏控制器提供单独的类。然而,我尝试为这个选项卡栏控制器创建一个类,但是当我调用它/初始化它时,它只是提供一个新的选项卡栏,而不是故事板上的内容。我已经坚持了一段时间了,所以任何帮助将不胜感激。所以应用程序是这样工作的。视图控制器1 ->视图控制器2 -> tabbarcontroller(有一个表视图和一个地图视图)

I created a tab bar controller in a story board which is working perfect. Now i need to move from a view controller to this tab bar controller. I do not have a separate class for the tab bar controller. However I tried creating a class for this tab bar controller but when i call it/initialise it, it just gives a new tab bar instead of whats on the storyboard. Ive been stuck with this for a while now so any help would be appreciated. So application works this way. viewcontroller1 -> viewcontroller2 -> tabbarcontroller (which has a table view and a map view)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩发小公举 2024-12-18 14:01:48

如果我正确理解你的问题,你想要做的就是在属性检查器中为 Storyboard 中的 TabBarController 分配一个标识符,然后使用它使用以下代码以编程方式实例化控制器:

UITabBarController *tabBarController = [self.storyboard instantiateViewControllerWithIdentifier:@"TabBarIdentifer"];

If I understand your question correctly, what you want to do is assign an identifier to the TabBarController in the Storyboard, in the Attributes Inspector, and then use that to programmatically instantiate the controller using this code:

UITabBarController *tabBarController = [self.storyboard instantiateViewControllerWithIdentifier:@"TabBarIdentifer"];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文