I'm trying to push something to my "current" navigation controller, but it's not going.
Why doesn't [[[[[[UIApplication sharedApplication] delegate] window] rootViewController] navigationController] presentModalViewController:myView animated:YES]; work?
[[window rootViewController] navigationController] refers to the navigation controller that contains the rootViewController. Since the root controller is not inside any navigation controller, it will be always nil.
The rootViewController is probably the navigation controller itself. If that is the case you can use the code below:
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentModalViewController:myViewController animated:YES]
By the way, you cannot present a view modally, you should present its controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With