2

can we change the selection color of table view, i.e cell, by default its blue, so, can we change it to any other color?

regards

Shishir.bobby
  • 10,994
  • 21
  • 71
  • 100

2 Answers2

3

Another way to do this, that doesn't require an image file is:

UIView *bgView = [[UIView alloc] init];
// At least on iOS6 you don't to size the view for this to work.
bgView.backgroundColor = [UIColor grayColor];
aCell.selectedBackgroundView = bgView;
Chris Prince
  • 7,288
  • 2
  • 48
  • 66
3

this way in code

aCell.selectedBackgroundView = [[[UIImageView alloc] 
      initWithImage:[UIImage imageNamed:@"selectedBackground.png"]] autorelease];

or you can set it in interface builder to gray, I think blue and grey is all that is available without creating a be view

Aaron Saunders
  • 33,180
  • 5
  • 60
  • 80
  • 1
    thanks aaron, i already used this snippet, i dont want to give image,cant we just color only. thanks for relpy... appreciated – Shishir.bobby Oct 18 '10 at 20:47
  • 1
    further googling led me to this http://stackoverflow.com/questions/281515/how-to-customize-the-background-color-of-a-uitableviewcell – Aaron Saunders Oct 18 '10 at 20:55