In iOS Settings > Wi-Fi for example, the cell's checkmark is on the left (of the connected network), with the disclosure button on the right.
I need this. Is there a standard way in iOS 7 to get this?
In iOS Settings > Wi-Fi for example, the cell's checkmark is on the left (of the connected network), with the disclosure button on the right.
I need this. Is there a standard way in iOS 7 to get this?
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;
In Swift 4 and later, place this guy in your viewDidLoad()
tableView.allowsMultipleSelectionDuringEditing = true
That's it!