How can I swipe a table cell and make it call a function?

How can I slide my finger across a table cell and call a function (in which I click the view controller on the navigation controller)?

+4
source share
1 answer

Just add 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 we implement the napkin processing method:

 - (void)cellWasSwiped:(UIGestureRecognizer *)g { NSLog(@"Swiped"); } 
+8
source

All Articles