i am trying to add a login screen to my app but when i tried changing the initial view controller to the login screen but when i change the initial view controller pointer it has no effect. I have tried the suggestions in:
iOS 7 - Failing to instantiate default view controller but they did not work for me. the first screen under the navigation controller is instead showing which was the intended initial view before the login was added.
App Delegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let centerViewController = mainStoryboard.instantiateViewControllerWithIdentifier("ViewController") as!ViewController
let drawerViewController = mainStoryboard.instantiateViewControllerWithIdentifier("DrawerViewController") as!DrawerViewController
let leftSideNav = UINavigationController(rootViewController: drawerViewController)
let centerNav = UINavigationController(rootViewController: centerViewController)
centerContainer = MMDrawerController(centerViewController: centerNav, leftDrawerViewController: leftSideNav)
centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView;
centerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView;
//works when i comment out this but navigation does not work then
//window!.rootViewController = centerContainer
window!.makeKeyAndVisible()
return true
}