【发布时间】:2019-10-11 11:14:36
【问题描述】:
我正在尝试呈现从底部到顶部显示的视图。这是我的代码
let myPageViewController = storyboard?.instantiateViewController(withIdentifier: "myPageViewControllerID") as! MyPageViewController
myPageViewController.modalPresentationStyle = .fullScreen
let navController = UINavigationController(rootViewController: myPageViewController)
navigationController?.present(navController, animated: true, completion: nil)
尽管我使用的是.fullScreen,但视图并未全屏显示。
我尝试使用 peformSegue 显示此代码的视图
self.performSegue(withIdentifier: "myPageViewSegue", sender: nil)
页面全屏显示,但从左到右,而不是从下到上。
我尝试的第三个代码是这个
let detailVC = MyPageViewController()
let navigationController = UINavigationController(rootViewController: detailVC)
navigationController.modalPresentationStyle = .fullScreen
present(detailVC, animated: true)
在这里我收到一个错误Application tried to present modally an active controller。我试图在 MyPageViewController 消失时添加 self.dismiss 但它没有帮助。
【问题讨论】:
标签: ios swift uiviewcontroller