Reputation: 767
I create a UINavigationController
(as a initial screen) and connect them with my UITableViewController
(as a root).
Next, I create another UINavigationController
and connect with my UIViewController
. Inside my UITableViewController
I connect my first cell with UINavigationController
(That was connected with my UIViewController
) (Segue -> show).
When I run the project my table appears, when I select my first row, my UIViewController appears. Thats great!
When I was in my UIViewController
the back bar button doesn't appears, in my case I create a left bar button, that will run a function to dismiss that view and go back to my UITableViewController
, for that I use many codes:
-(void)back{
NSLog(@"Called");
[self.parentViewController.navigationController popViewControllerAnimated:YES];
}
-(void)back{
NSLog(@"Called");
[self.navigationController popViewControllerAnimated:YES];
}
-(void)back{
NSLog(@"Called");
[self.navigationController popViewControllerAnimated:YES];
}
But all of they doesn't works and my view don't dismiss, how can I solve this problem?
Upvotes: 1
Views: 447
Reputation: 797
I think that the solution would be to remove the second navigation controller. Since the TableView is already embedded inside a Navigation Controller, the show segue to the UIViewController must be directly connected to it.
Upvotes: 1
Reputation: 15247
The problem is that your navigation controller, that you call from your table view cell, has only a single view controller (yours) on its navigation stack. So it cannot pop anything from this stack, else the stack were empty.
What you have to do instead is to dismiss the navigation controller itself.
Upvotes: 2