Change color on checkmark in UITableView

Can anyone be so kind as to show me how to change the color of a checkmark in a UITableView?

I searched, but didn't seem to work.

Greetings

+54
objective-c uitableview uicolor
Oct 03 2018-11-11T00:
source share
15 answers

Apple does not provide a public way to change the color of a checkmark, so you have to do this with the image.

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

It will look like this:

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

Enjoy it!

+42
Oct 03 2018-11-11T00:
source share

Since the iOS SDK has changed since I accepted the answer, I thought I was just updating a new answer.

In fact, you can change the color of the checkmark in the UITableViewCell by editing the tintColor property of the UITableViewCell.

You can also set the appearance proxy for all UITableViewCells so that ALL instances have a specific hue color, unless otherwise specified

 [[UITableViewCell appearance] setTintColor:[UIColor redColor]]; 
+200
Sep 23 '13 at 9:38 on
source share

If you are looking for a version of Swift:

Directly on the cell

For example, in tableView(_:,cellForRowAtIndexPath:)

 cell.tintColor = UIColor.redColor() 

Using appearance protocol

 UITableViewCell.appearance().tintColor = UIColor.redColor() 
+31
Aug 05 '15 at 4:37
source share

IOS 7 worked for me.

 [self.tableView setTintColor:[UIColor someColor]]; 
+29
Nov 23 '13 at 16:17
source share

This image shows how to do this in storyboards. The color of the shade is a tick.

enter image description here

+14
Nov 06 '14 at 5:27
source share

I found that igraczech's answer is mostly correct, but with iOS 6 or later, you can just set the hue color of the whole table view, and the default elements inherit down.

 [self.tableView setTintColor:[UIColor someColor]]; 

It worked for me and allowed me to tick off.

+13
Nov 22 '13 at 14:34
source share

By launching iOS 7, you can set the color of the hue in the view controller's view so that this color hue is extended to all its child views. Therefore, to set the checkbox UITableViewCell to purple (for example), in your viewWillAppear method you need:

 [self.view setTintColor:[UIColor purpleColor]]; 
+8
05 Oct '13 at
source share
  UITableViewCell *cell=(UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"CellIdentifier" forIndexPath:indexPath]; cell.tintColor=UIColor.whiteColor; return cell; 
+4
Apr 10 '18 at 11:58
source share

The UIAccessoryTypeCheckmark (right side) inherits the background color of its table view.

 self.tableView.backgroundColor = [UIColor clearColor]; 
+3
May 11 '13 at 17:10
source share
 #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; 
+2
Dec 19 '14 at 16:34
source share
 - (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; } 

This works for me.

+2
Jul 17 '15 at 12:02
source share

I always used this simple way:

 UITableViewCell *cell = ...; cell.tintColor = [UIColor greenColor]; cell.accessoryType = UITableViewCellAccessoryCheckmark; 
+2
Nov 27 '17 at 16:21
source share

You do not need to use your own image, you can just change it in your view by downloading it using the following code.

 [self.tableView setTintColor:[UIColor colorWithRed:250/255.0 green:223/255.0 blue:6/255.0 alpha:1]] 

Hurrah!

+1
May 21 '15 at 6:26
source share

The above answers are all excellent. But if you want to do it globally, just do

 UITableViewCell.appearance().tintColor = .green 

Nice little trick :)

+1
Apr 08 '19 at 2:06
source share

Swift 3.1, iOS 9+

 if #available(iOS 9.0, *) { UIImageView.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).tintColor = UIColor.themeTint //add your color here } else { // Fallback on earlier versions } 

Result

0
May 09 '17 at 12:20
source share



All Articles