【发布时间】:2019-01-26 13:05:12
【问题描述】:
看起来是重复的吧??
但是我在网上搜索,我什么也没找到..
请有人帮助我如何在按钮单击时打开 UIPageViewController
如果我们想打开 uiviewcontroller 我们可以使用它
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("nextView") as NextViewController
self.presentViewController(nextViewController, animated:true, completion:nil)
但是 UiPageViewController 呢??
如何做到这一点?
【问题讨论】:
-
我认为如果 NextViewController 是 UIPageViewController 应该可以工作,错误是什么?
-
如果有重要的数据需要传递来填充pageViewController,你需要:
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("nextView") as NextViewController NextViewController.importantDataVariable = ImportantData self.presentViewController(nextViewController, animated:true, completion:nil)才能在不崩溃的情况下打开它。
标签: ios swift uipageviewcontroller