Here's my code:
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
But when I run the app, I can't see the checkmark.
Then I set background color to black, and I can see a white checkmark.
How to change checkmark's color to other colors like blue?
Yes you can do it.
Just set the tintColor
of cell.
cell.tintColor = UIColor.whiteColor()
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
Swift 3
let aCell = tableView.dequeueReusableCell(withIdentifier: "Cell")!
aCell.tintColor = UIColor.red
aCell.accessoryType = .checkmark
return aCell
You can also do it from Attributes Inspector
Just set the tint color of UITableViewCell from Attribute Inspector or by coding like below
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "SimpleTableViewCell"
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
// just add below lines
cell.accessoryType = UITableViewCellAccessoryType.checkmark
cell.tintColor = UIColor.red
return cell
}
@HenriqueGüttlerMorbin check this hope it will work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With