I have an UITableView
to display some elements, when I click in each cell I can see its detailViewController. I would like to pass from one detailViewController to the next making an UISwipeGestureRecognizer
to left, and if I make UISwipeGestureRecognizer
to right, get back to the tableView.
Thank you
Add the swipe recognizer to your view or tableview
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(goToNextView)];
[swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
[self.view addGestureRecognizer:swipeLeft]; //Add to the view or tableview or whatever
Add the method
- (void)goToNextView
{
YourViewController *vc =
[self.storyboard instantiateViewControllerWithIdentifier:@"yourViewControllerIdendifier"];
[self.navigationController pushViewController:vc animated:YES];
}
Do the same to go back but instead of using push, use pop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.