繁体   English   中英

在UIViewController之间切换问题

[英]Issue switching between UIViewController

我有一个标签栏应用程序,因为我可以在UIViewController之间切换而不会丢失任何类型的数据。 但是现在我想使用UIButton更改UIViewController 我已经使用Show使用了简单的情节提要板快捷方式。 但是当我返回主UIViewController我丢失了所有数据和功能。 如何在UIViewController之间切换而又不重新创建新的UIViewController但又回到原来的状态。

不要使用segue。 它将实例化目标视图控制器的新实例。

在UIButton的动作中,说出类似以下内容:

self.tabController.selectedIndex = 1 //or whatever the index of the view controller you want to switch to is

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM