I have a view controller (MailServicesController) which I have presented modally. I am trying to add to this MailServicesController a UINavigationController (programmatically) that will allow me to push and pop another view controller (LoginController). I have implemented code to do this but am having two specific problems:
The navigation controller pushes the loginViewController onto the top of the stack, but does not animate this transition even though I have set the animation BOOL to YES in the push method.
Once in the loginViewController, when I try to use popViewControllerAnimated, nothing happens (I made my own button for popping, I am not using the nav controller's navbar).
Here is the code I use to create the nav controller inside the MailServices modal view controller:
self.navigationController = [[UINavigationController alloc]init];
[self.navigationController willMoveToParentViewController:self];
self.navigationController.view.frame = self.view.frame;
[self.view addSubview:self.navigationController.view];
[self addChildViewController:self.navigationController];
[self.navigationController didMoveToParentViewController:self];
[self.navigationController pushViewController:LoginController animated:YES];
//pushes login controller but with no animation
Then in the LoginController, I try to pop the LoginController off the top to reveal the controller I pushed from:
- (void)dismissView //called by a button in my custom toolbar
{
UINavigationController *navigationController = (UINavigationController
*)self.parentViewController; //this is the navigationController I created
[navigationController popViewControllerAnimated:YES]; //is called but does nothing
}
I am not sure what I am doing wrong, can anyone see my mistake?