1

I have a Navigation Controller and a tableView with several Entries. If i select an Entry a new DetailViewController gets pushed. in the DetailViewController you can swipe right to push the DetailViewController of the next Entry of the tableView. Its working pretty well, but if people swipe about 10 times, they need to press the back button 10 times to get back to the tableView. So I'm looking for a nice way for people pressing back and coming to the tableView.

I thought about recreating the backbutton and use the popToRootViewControllerAnimated:

but is there another way i can solve my problem? maybe something like deleting all views on the navigation stack and keep only the last one.

Andreas Daoutis
  • 1,195
  • 8
  • 16

1 Answers1

0

Instead of pushing a new DetailViewController you could just update the details with the details from the next/previous Entry from the tableview.

You would lose the swipe/push animation, but this could be worked around.

Another possibility is to use:

[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];

You'll need to work out what index the tableViewController is. If it's the root view controller then the index should be 0.

Ben
  • 1,382
  • 10
  • 14