iOS推送到TabBarController [英] iOS Push to TabBarController

查看:142
本文介绍了iOS推送到TabBarController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个视图控制器,在最后一个视图控制器上,我希望当用户单击此视图中存在的按钮时,他继续使用另一个包含tabbarcontroller的视图控制器.

例如,我有这样的东西:

如何从第一个视图转到标签栏控制器?

我试图仅设置按钮到选项卡栏控制器的按动,但是它运行不正确.

解决方案

您必须将按钮的视图控制器嵌入到UINavigationController中,否则会出现如下错误:

由于未捕获的异常"NSGenericException"而终止应用程序,原因:仅在由UINavigationController的实例管理源控制器时才能使用推送选择."

一旦将其放在UINavigationController中,它在测试中的过渡就很好.

如果您不希望使用UINavigationController,则可以将segue设置为Modal,它也应该过渡到Tab栏,但以模态进行.

i have several viewcontrollers, and at the last viewcontroller, i want when the users click on a button present in this view, he goes on a other view controller which contains tabbarcontroller.

For example, i've something like this :

How can i go from the first view, to the tab bar controller ?

EDIT : i tried to just set a push from the button to the tab bar controller, but it's not runnin g correctly.

解决方案

You have to embed the button's view controller in a UINavigationController, otherwise you will get an error like this:

Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

Once I put it in a UINavigationController, it transitioned just fine in my tests.

If you do not want a UINavigationController, you can set the segue to Modal, and it should also transition to the Tab Bar, but modally.

这篇关于iOS推送到TabBarController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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