我以这样的方式呈现了一个NavigationController:
let profileViewController = ProfileViewController(nibName: nil, bundle: nil)
let navigationControllerProfile = UINavigationController(rootViewController: profileViewController)
navigationControllerProfile.setNavigationBarHidden(true, animated: false)
navigationControllerProfile.modalPresentationStyle = .fullScreen
self.present(navigationControllerProfile, animated: true, completion: nil)
每当我从这个NavigationController推送Viewcontroller时:
let showCaseViewController = ShowcaseViewController()
showCaseViewController.modalPresentationStyle = .overFullScreen
self.navigationController?.pushViewController(showCaseViewController, animated: true)
ViewController被正确推送,但在1秒后整个NavigationController被清除。
发布于 2020-09-29 15:37:33
用于显示带有导航的视图控制器的代码
let vc = storyboard?.instantiateViewController(withIdentifier: "firstvc") as! firstvc
let navigation = UINavigationController(rootViewController: vc)
vc.modalPresentationStyle = .fullScreen
self.present(navigation, animated: true, completion: nil)
用于在呈现的视图控制器内执行推送操作的代码
let vc = storyboard?.instantiateViewController(withIdentifier: "email") as! email
self.navigationController?.pushViewController(vc!, animated: true)
https://stackoverflow.com/questions/64111236
复制相似问题