I am presenting a tutorial view, from the AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
....
EERootVC *rootVC = (EERootVC *)self.window.rootViewController;
UINavigationController *navcon = (UINavigationController*)rootVC.contentViewController;
EETutorialRootVC *rootTutorialViewController = [rootVC.storyboard instantiateViewControllerWithIdentifier:@"EETutorialRoot"];
[navcon pushViewController:rootTutorialViewController animated:NO];
return YES
}
How can I dismiss this new view once completed?
I've tried this:
[self.navigationController popViewControllerAnimated:YES];
Which works, but the view it returns to seems to be cut off (shifted up?)
Its not going to be self
because calling self
in AppDelegate
is referencing itself (which will be AppDelegate
)
If you want to dismiss it from the AppDelegate
you simply do the same thing you did to present it:
[rootTutorialViewController popViewControllerAnimated:YES];
But your more than likely not going to dismiss it in the AppDelegate
, your more then likely going to dismiss it in the view controllers main class, which is where you would call self
Mmm, it seems you work with some custom setup that you have to provide insight in, so we can give you a better answer.
If you window.rootViewController would be an instance of UINavigationController you'd have pretty default behaviour and if you'd push and pop ViewControllers, everything would look good.
But you are getting the UINavigationController from a custom property of your window.rootViewController. That suggests that EERootVC is some custom ContainerViewController and my bet is something goes wrong in there where you add the EERootVC.contentViewController to it's view and set it's frame.
For example, set the UINavigationController as the Window's rootViewController and I bet it works as supposed too.
Other then that, you push it without animation, and dismiss it with animation. For a good user experience you probably want to think about that approach again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.