0

I Am Doing this from AppDelegate. I have two storyBoards, main storyBoard and secondStoryboard. When i set main interface to secondStoryboard from deployment info of app target, and run the project the following code works as charm.

But When i set main interface to main story board from deployment info of app target, and run the project it is Throwing the warning and the presentViewcontroller method is not working.

:( pls help ! Thanks in advance.

var storyBoard: UIStoryboard = UIStoryboard(name: "secondStoryBoard", bundle: nil)
var congratulationScreen = storyBoard.instantiateViewControllerWithIdentifier("s_id_SecondVC") as! SecondVC
var navController = UINavigationController(rootViewController: congratulationScreen)
self.window?.makeKeyAndVisible()
self.window?.rootViewController?.presentViewController(navController, animated: true, completion: nil)
Community
  • 1
  • 1
dip
  • 3,548
  • 3
  • 24
  • 36

1 Answers1

0

check this call after delay with dispatch Queue

   let delayTime = dispatch_time(DISPATCH_TIME_NOW,
            Int64(0.1*Double(NSEC_PER_SEC)))
        dispatch_after(delayTime, dispatch_get_main_queue()) {
            var storyBoard: UIStoryboard = UIStoryboard(name: "secondStoryBoard", bundle: nil)
            var congratulationScreen = storyBoard.instantiateViewControllerWithIdentifier("s_id_SecondVC") as! SecondVC
            var navController = UINavigationController(rootViewController: congratulationScreen)
            self.window?.makeKeyAndVisible()
            self.window?.rootViewController?.presentViewController(navController, animated: true, completion: nil)


        }
Gaurav Patel
  • 957
  • 1
  • 6
  • 16
  • I think this replaces the root view controller of window, my problem is on presenting the viewController over rootviewController @Gaurav – dip Jul 09 '15 at 07:18