0

I have table view cell with segmented control on it. I want to make my cell untouchable. It shouldn't highlight grey when user touches it. If I set user interaction enabled property to false, segmented control, doesn't work. How should I make my cell untouchable to work with segmented control.

Nikita Zernov
  • 5,465
  • 6
  • 39
  • 70

2 Answers2

1

Undtouchable means, that there is no User Interaction allowed (also with all your Controls inside your Cell)

If you just want to remove the cell selection, set this to None:

cell.selectionStyle = UITableViewCellSelectionStyleNone;
derdida
  • 14,784
  • 16
  • 90
  • 139
  • This will disable the colour when touched. If you also want to disable to selection action, return `nil` from `-tableView:willSelectRowAtIndexPath:` for that row. – thelaws Oct 07 '14 at 17:36
0

As @thelaws said, tableView:willSelectRowAtIndexPath: should be used here, generally it is used when you want to select some other row ( row other than selected by the user) but if you return nil, it will not select any row.

And for disabling selection color just use

[cell setSelectionStyle:UITableViewCellSelectionStyleNone];

iHulk
  • 4,869
  • 2
  • 30
  • 39