Can we go to main TableView from any DetailView when we click Back button?

729 Views Asked by At

I am making an application which has a main TableView in which every cell has details. when cell is clicked DetailView of that cell shows details. DetailView also has next and prev button from which we can go to next cell information without going back to main TableView. I want Back button in DetailView to work like that whenever i ll click it, application should show main TableView. Is there any way to do that?

I think i didnt explain my problem well. I have items in main TableView cells. and every cell creates a detail view when i click on that. there are next and previous buttons in every detailview so we can check next item details without going back to main table view. there is a back button on every detail view. for example if u clicked 3rd cell to see details. and then u went to 4th item's detail by using next button. now if u ll click back button it ll go back to 3rd view detail not the main table view. i wanna go back to main table view whenever i ll click back button. thats the problem.

3

There are 3 best solutions below

3
On BEST ANSWER

s u can do this by

       [self.navigationController popViewController:YES];

through this without using back button. when u click on cell detailview, it goes back to the view

6
On

Have you tried to push the detailview like this:

YourDetailView * detailView = [[YourDetailView alloc] init];

[self.navigationController pushViewController:detailView animated:YES];

[detailView release];

6
On

Main view is called Root, use this

[self.navigationController popToRootViewControllerAnimated:YES];