2

I set uitableviewcellselectionstylenone on cells when I created cell. On long press I need to select exact cell, is it posible to do?

ArisRS
  • 1,334
  • 2
  • 18
  • 40
  • 1
    You could add a gesture recogniser, or create a custom cell which doesn't draw the blue highlight on tap but still sends the "did select" delegate call. – mattjgalloway Dec 09 '11 at 11:38

1 Answers1

1

Add a UILongPressGestureRecognizer to the table. You can find out the cell on which the user long-pressed by calling indexPathForRowAtPoint.

CGPoint p = [gestureRecognizer locationInView:self.myTableView];
NSIndexPath *indexPath = [self.myTableView indexPathForRowAtPoint:p];

See the accepted answer to this question for a complete example.

Community
  • 1
  • 1
Sergey Kalinichenko
  • 697,062
  • 78
  • 1,055
  • 1,465