Change color on checkmark in UITableView

后端 未结 15 2242
故里飘歌
故里飘歌 2020-12-07 22:31

Could someone be so kind to show me how to change the color on the checkmark in UITableView?

I have searched but don\'t seem to get it to work.

Cheers

相关标签:
15条回答
  • 2020-12-07 23:30

    I always used this easy way:

    UITableViewCell *cell = ...;
    cell.tintColor = [UIColor greenColor];
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    
    0 讨论(0)
  • 2020-12-07 23:31

    The following worked for me in iOS 7.

    [self.tableView setTintColor:[UIColor someColor]];
    
    0 讨论(0)
  • 2020-12-07 23:32

    Apple doesn't provide a public way to change the color of the checkmark so you'll have to do it with an image.

    This is very simple, just set the accesoryView property of the cell to a UIImageView containing a checkmark of the correct color.

    It'll look like this:

    UIImageView *checkmark = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"coloredCheckmark.png"]];
    cell.accessoryView = checkmark;
    [checkmark release];
    

    Enjoy!

    0 讨论(0)
提交回复
热议问题