20

I want to change the color of UITableViewCellAccessoryCheckmark and UITextField background color where we type. I found this is not straight forward.

iDifferent
  • 2,190
  • 1
  • 14
  • 19
Dilshan
  • 3,231
  • 4
  • 39
  • 50
  • Feel the same way. @Dilshan: go and accept answers to your previous questions, please. – DarkDust Oct 21 '10 at 09:59
  • 2
    Just got to know that features. New to stackoverflow :) – Dilshan Oct 21 '10 at 10:51
  • 3
    To be clear, there is no obligation to accept answers, but you should accept any that worked for you, both to indicate to future readers the successful solution and to reward the author of that answer. – Peter Hosey Oct 21 '10 at 17:10

2 Answers2

47

I solved this issue by changing the tint color of the UITableView where the cell belongs.

Update the Tint Color of UITableView in interface builder to Default

or programmatically as below.

For Objective C

yourTableView.tintColor =  [UIColor blackColor];

For Swift

yourTableView.tintColor = .black
Atanu Mondal
  • 1,714
  • 1
  • 24
  • 30
3

By default,you cannot change the color of UITableViewCellAccessoryCheckmark

But alternatively you can use the image for this..as just like checkmark

while for textField you can use this single line..

[textField setBackgroundColor:[UIColor redColor]];
Vikas S Singh
  • 1,748
  • 1
  • 14
  • 29
Ajay Sharma
  • 4,509
  • 3
  • 32
  • 59
  • 3
    Specifically, you'd use the `accessoryView` property of the cell instead of `accessoryType`. – Daniel Dickison Oct 21 '10 at 17:27
  • Thanks Ajay But when you call the setBackgroundColor it will set the background color but it will not change the color of the ares where the text resides. I want to change the color of lets say foreground of the text field. – Dilshan Oct 22 '10 at 11:33
  • 2
    It is no longer true. Please see the answer by Atanu – honcheng Feb 24 '15 at 04:12