Closed hadiidbouk closed 6 years ago
I figure out that the problem is only happen when the segue is push not set.
Hi, the code should be like this (if you don't want a right view controller, pass nil):
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewController(withIdentifier: "MainNavController")
let leftNavController = storyboard.instantiateViewController(withIdentifier: "LeftNavController")
let rightViewController = storyboard.instantiateViewController(withIdentifier: "RightViewController")
let revealViewController = PBRevealViewController(leftViewController: leftNavController, mainViewController: mainViewController, rightViewController: rightViewController)
window?.rootViewController = revealViewController
window?.makeKeyAndVisible()
return true
}
Hello ,
I am showing the mainVC progmatically after performing some code in the appdelegate file,
The problem that i don't have any initial view controller in the storyboard.
the problem here
self.contentView?.addSubview(self.mainViewController!.view)
the mainViewController is nil, i try to set it progmatically in my "MainVC" that extends
PBRevealViewController
but it seems that theloadView()
in thePBRevealViewController
start first.