Swift中使用presentViewController跳转页面后模拟器显示黑屏问题
发布时间:2020-12-14 01:35:03 所属栏目:百科 来源:网络整理
导读:Swift中使用presentViewController跳转页面后模拟器显示黑屏问题 问题原因 针对storyboard制作页面和手写页面,需要使用两种不同方法进行页面跳转。 解决办法 针对手写页面及storyboard制作页面,使用代码进行页面跳转的两种方法。 对于使用storyboard制作的
Swift中使用presentViewController跳转页面后模拟器显示黑屏问题问题原因针对storyboard制作页面和手写页面,需要使用两种不同方法进行页面跳转。 解决办法针对手写页面及storyboard制作页面,使用代码进行页面跳转的两种方法。 对于使用storyboard制作的页面var sb = UIStoryboard(name: "Main",bundle:nil)
var vc = sb.instantiateViewControllerWithIdentifier("myViewController") as MyViewController
self.presentViewController(vc,animated: true,completion: nil)
其中 myViewController 是在 Main.storyboard 中选中的 MyViewController 的 storyboardID 值。可以在 Identifier inspector 中修改。 对于手写页面var vc = MyViewController()
self.presentViewController(vc,completion: nil)
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |