Reputation: 1986
I currently am working on my user creation page, here's a picture:
I need the cancel button to simply "popViewControllerAnimated: YES" to my login page. The User Creation page is embedded in a navigation controller, and that NavController has it's own top bar set to "opaque black navigation controller" and the user creation controller does also("Top Bar" in att. inspector set to "opaque black nav controller"). The UIBarButtonItem has this outlet -->
@property (weak, nonatomic) IBOutlet UIBarButtonItem *cancelUserCreation;
and is connected to this IBAction .h:
- (IBAction)cancelUserCreation:(UIBarButtonItem *)sender;
.m:
- (IBAction)cancelUserCreation:(UIBarButtonItem *)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
What am I doing wrong? Provide code if you can please.
P.S. The UserCreation page is embedded in a navigationController, consisting of three layers in the following hierarchy: MasterView>ScrollView>ContentView, where ContentView holds all of the objects in the view, and the segue from my login page to that navController is modal. altogether, the transitions are: LoginHomeViewController->modalseg->navController->embed->UserCreationViewController
Upvotes: 0
Views: 172
Reputation: 1748
The UserCreationViewController
is the root view controller of the navController
, popViewControllerAnimated
method does nothing. You cannot pop the last item on the stack.
call this:
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
Upvotes: 1