Appdelgate
不是一个
UIViewController
,
所以你不能用
pushViewController(detailBrand, animated: true)
因为你现在的处境不太好
UIVewController
但是相反,你可以启动一个
UINavigatetionController
把它设为你的根,然后从根上推下去。
你的代码应该是这样的
let rootViewController = self.window!.rootViewController as! UINavigationController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let profileViewController = mainStoryboard.instantiateViewController(withIdentifier: "PagerOverviewControlerID") as! PagerOverviewControler
rootViewController.pushViewController(profileViewController, animated: true)
didFinishLaunchWithOption
方法。
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool