My transition to the next view is like this:
if let navigationController = navigationController {
if let storyboard:UIStoryboard = UIStoryboard(name: "myStoryboard", bundle: nil) {
if let vc = storyboard.instantiateViewControllerWithIdentifier("myViewController") as? MyViewController {
dispatch_async(dispatch_get_main_queue()) {
navigationController.presentViewController(vc, animated: true, completion: nil)
}
}
}
}
This works fine. I want this kind of transition. But when I call following code in MyViewController, the NavigationController is nil:
if let navigationController = navigationController {
print("yeah i have a nc")
} else {
print("its nil") //this will call
}
When I use navigationController.pushViewController(vc, animated: true)
everything works fine. But I really want the transition. Is this a wrong implementation on my side or is presentViewController
always without a navigationController? If yes, what can I do?
My Controller A is already embedded in a navigationController. I use navigationController.presentViewController to go to MyViewController. And from MyViewController I want to push to a next ViewController C.