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
The UIAccessoryTypeCheckmark (right side) inherits background color of its tableview.
self.tableView.backgroundColor = [UIColor clearColor];
#import "UIImage+Color.h"
UIImage *image = [[UIImage imageNamed:@"ic_check_black_24dp.png"] changeColor:CLR_BUY];
UIImageView *checkmark = [[UIImageView alloc] initWithImage:image];
cell.accessoryView = checkmark;
The above answers are all great. But if you want to do it globally, just do
UITableViewCell.appearance().tintColor = .green
Nice little trick :)
I found that igraczech's answer is mostly correct, but with iOS 6 or later, you can just set the tint color of the entire tableview and default items will inherit down.
[self.tableView setTintColor:[UIColor someColor]];
This worked for me and allowed me to color in the checkmark.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
HNCustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HNCustomTableViewCell" forIndexPath:indexPath];
cell.tintColor = [UIColor colorWithRed:0.99 green:0.74 blue:0.10 alpha:1.0];
return cell;
}
It work for me.
Starting iOS 7 you could set the tint color of your view controller's view so that this tint colow will be propageted to all it's child views. So to set your UITableViewCell's checkmark as purple color (for example), in your viewWillAppear method you need to:
[self.view setTintColor:[UIColor purpleColor]];