【发布时间】:2020-08-04 05:06:47
【问题描述】:
这件事对 ios 开发来说是新的,这是我的第二个应用程序,在处理第一个应用程序时,我主要使用一个主题,然后对其进行了处理,但这个我从头开始工作。
我的主要问题是从一个屏幕转到另一个屏幕
当我使用此代码时,它可以工作
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let nextViewController = storyBoard.instantiateViewController(withIdentifier: "servicesScreen") as! ServiceViewController
nextViewController.modalPresentationStyle = .fullScreen
self.present(nextViewController, animated:true, completion:nil)
但我需要使用这个,所以我也可以回去,但这不会做任何事情
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "servicesScreen") as! ServiceViewController
self.navigationController?.pushViewController(newViewController, animated: true)
我的问题是,我在这里做错了什么还是需要在 scenedeligate 中添加一些东西?
【问题讨论】:
-
您是否将导航控制器添加到 ServiceViewController??