简体   繁体   English

iOS更改rootViewController

[英]iOS change rootViewController

I have 3 viewControllers named firstController, secondController and thirdController. 我有3个名为firstController,secondController和thirdController的viewControllers。 My logic is firstController.presentViewController(secondController), then secondController.presentViewController(thirdController), and the set a rootViewController by UIApplication.shareApplication().keywindow!.rootViewController = firstController... 我的逻辑是firstController.presentViewController(secondController),然后secondController.presentViewController(thirdController),然后通过UIApplication.shareApplication()。keywindow!.rootViewController = firstController设置一个rootViewController ...

But when I set firstController as the rootViewController, when presenting viewController from secondController to thirdController with thirdController.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve, the firstController will show during the animate. 但是,当我将firstController设置为rootViewController时,在将thirdController.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve的viewController从secondController呈现给thirdController时,firstController将在动画期间显示。

May I should not use the rootViewController like this? 我可以不这样使用rootViewController吗?

我认为您应该有一个一级rootViewController来呈现所有内容,即,只有firstController应该调用presentViewController。

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

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