i have a table view. i divided it into 3 sections. i want to implement swipe in this tableview. when i swipe in table view, next view will be loaded. How to implement this? Thanks in advance
Generally, your table view controller will implement the UITableViewDelegate
protocol. The tableView:didSelectRowAtIndexPath:
method is called when the user touches one of the rows in your table view. If you implement the method, you can use row
and section
properties of the NSIndexPath
that are passed in to determine which row in you table the user selected. Based on the selection, you can then create or initialize the appropriate next view controller that you want to load and then push the new controller on the table view controller's navigationController
.
For further info, try reading:
You have basically two options:
I: Use UISwipeGestureRecognizer
Since I never worked used it, there is not much I can tell you about this way. Just see the official documentation for further information. You should know, that it was introduced with iOS 3.2, so there is no support for iPhones which are not running iOS 4.0, so especially firstGen iPhones will be excluded.
II: Overwrite touchesBegan/Moved/Ended
Read this post for further information, this should be exactly what you need. Of course, this solution does not only work for UITableViews but for every class that inherits from UIResponder (and consequently for every UIView).