I can not change the rootViewController

0

Hello, take it easy with me because I am extremely beginner.

I'm trying to change the root of an application I'm trying to do. It even worked when I commented on window!.rootViewController = centerContainer

But when I do this, the menu stops working. Can someone give me a help? I think all my complication is in AppDelegate.

class AppDelegate: UIResponder, UIApplicationDelegate {


var window: UIWindow?

var centerContainer: MMDrawerController?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    _ = self.window!.rootViewController

    let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)



    let centerViewController = mainStoryboard.instantiateViewControllerWithIdentifier("homeViewController") as! homeViewController

    let leftViewController = mainStoryboard.instantiateViewControllerWithIdentifier("LeftSideViewController") as! LeftSideViewController

    let rightViewController = mainStoryboard.instantiateViewControllerWithIdentifier("RightSideViewController") as! RightSideViewController

    let leftSideNav = UINavigationController(rootViewController: leftViewController)
    let centerNav = UINavigationController(rootViewController: centerViewController)
    let rightNav = UINavigationController(rootViewController: rightViewController)

    centerContainer = MMDrawerController(centerViewController: centerNav, leftDrawerViewController: leftSideNav,rightDrawerViewController:rightNav)

    centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView;
    centerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView;

    window!.rootViewController = centerContainer

    window!.makeKeyAndVisible()






    return true
}
    
asked by anonymous 25.04.2016 / 00:28

1 answer

1
let storyboard = UIStoryboard(name: "PaginaInicial", bundle: NSBundle.mainBundle())      
let loginView: SignInVC = storyboard.instantiateViewControllerWithIdentifier("SignInVC") as! SignInVC
UIApplication.sharedApplication().keyWindow?.rootViewController = loginView
    
25.04.2016 / 16:46