How can i swipe my finger on a table cell and call a function ( in which i push a view controller to my navigation controller ) ?
Just add a UISwipeGestureRecognizer
to the cell.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UISwipeGestureRecognizer *g = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(cellWasSwiped:)];
[cell addGestureRecognizer:g];
[g release];
}
Then implement the method to handle the swipe:
- (void)cellWasSwiped:(UIGestureRecognizer *)g {
NSLog(@"Swiped");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With