How to get checkmark on left side of UITableViewCell on iOS 7, like in Settings?
Without using a custom cell, you may prefer UITableViewCellStyleDefault
styled cell. It has an optional imageView
, use checkmark as an image.
Or, you can use unicode symbols for checkmarks. It is a pretty neat solution and greatly explained here.
There is no standard way to put an accessory on the left, it seems that they just use cell's imageView for the checkmark and built-in detail disclosure indicator on the right.
This is not exact solution but something close what iOS is doing in their WiFi listing, using only unicode character for checkmark and attributed string to set color to checkmark.
NSString *strCellText = @"This row is selected";
NSString *strCheckMarkUnicode = @"\u2713";
NSString *strFinalText = [NSString stringWithFormat:@"%@ %@",strCheckMarkUnicode,strCellText];
NSMutableAttributedString *strAttributedText = [[NSMutableAttributedString alloc]initWithString:strFinalText];
NSRange range=[strFinalText rangeOfString:strCheckMarkUnicode];
[strAttributedText addAttribute:NSForegroundColorAttributeName
value:[UIColor blueColor]
range:range];
_cellOne.textLabel.attributedText = strAttributedText;