首页 > 编程语言 > 详细

Swift中使用presentViewController跳转页面后模拟器显示黑屏问题

时间:2015-12-05 22:41:34      阅读:326      评论:0      收藏:0      [点我收藏+]

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, animated: true, completion: nil)

Swift中使用presentViewController跳转页面后模拟器显示黑屏问题

原文:http://blog.csdn.net/kongxx/article/details/50188285

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!