16

For my app, I want a number of cells that can have both a checkmark and a detail disclosure button. That is, I want them to appear exactly like the Wi-Fi network selection in the iOS settings: checkmark on the left side, content in the middle, and detail disclosure button on the right.

Is there a proper way to do this, or am I supposed to just use an image of a checkmark in the image part of the cell content? If you know of any sample code doing this sort of thing, please point me to it.

SeanR
  • 7,899
  • 6
  • 27
  • 38

3 Answers3

7

The standard styles for UITableViewCell do not include one that works as you want, so you'll have to do this yourself by manually adding a subview to the cell.

You could use the example here as a starting point.

Jason Foreman
  • 2,146
  • 18
  • 15
1

You can achieve it by simply prepending a couple of unicode symbols: Put checkmark in the left side of UITableViewCell

Community
  • 1
  • 1
Eddie G.
  • 2,344
  • 2
  • 17
  • 7
1

Why don't you add a image to the standard imageView of the cell then a tapGesture on it ?

Here is how I did in willDisplayCell:

//Reset the cell
cell.imageView.image=nil;
cell.imageView.userInteractionEnabled=NO;

for(UIGestureRecognizer *recognizer in cell.imageView.gestureRecognizers)
    [cell.imageView removeGestureRecognizer:recognizer];

//Add the gesture
cell.imageView.userInteractionEnabled=YES;
cell.imageView.image=[UIImage imageNamed:@"myImage"];

UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(geolocationAction:)];
[cell.imageView addGestureRecognizer:tapGestureRecognizer];
Bejil
  • 412
  • 5
  • 18