【发布时间】:2020-12-02 12:07:44
【问题描述】:
我有一个视图控制器(没有嵌入到导航控制器中)。假设 mainVC,从 maninVC 我有一个名为 goNext 的按钮。当我点击时,我需要对我的同一个 VC mainVC 进行一些标签更改。
所以我做到了:
这是在应用委托中:
let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let exampleVC = storyBoard.instantiateViewController(withIdentifier: "MainVC")
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = exampleVC
self.window?.makeKeyAndVisible()
我的VC:
func pushToMainVc() {
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let loginPageView = mainStoryboard.instantiateViewController(withIdentifier: "MainVC") as! MainVC
let rootViewController = self.window?.rootViewController as? UINavigationController
rootViewController?.pushViewController(loginPageView, animated: true)
}
但它没有推动。任何帮助都会很棒。
谢谢
【问题讨论】:
标签: ios swift xcode uinavigationcontroller