Reputation: 16851
When the user clicks on a row in a TableViewController
. I want select the content of that view and the user should navigate back to the previous screen.
How can i do this.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// How to navigate back to the previous view ?
}
Please note that this is a Navigation Controller
based application.
Upvotes: 0
Views: 284
Reputation: 1334
[self.navigationController popToViewController:[YOUR ViewContoller]] animated:YES];
This is the best way to return specific view controller. If you have more than one view controller you should for-in loop and catch your viewcontroller and assing it to [YOUR Viewcontroller] place.
Upvotes: 1
Reputation: 213
try this :
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
Upvotes: 0
Reputation: 87
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:`(NSIndexPath *)indexPath {`
[self.navigationController popToRootViewControllerAnimated:YES];
}
Upvotes: 1