Take the 2-minute tour ×

I have created a UITableView with customising a TableCell, generally following this tutorial;


I have customised it to my needs and it looks fantastic. However, when I select a row it highlights that row by changing the entire thing blue. This highlight covers the entire cell and overrides the content, effectively making a big blue box which looks nasty. I have tried the alternate highlight options of

cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.selectionStyle = UITableViewCellSelectionStyleGray;

Obviously if selected as gray, the same behaviour happens but with a gray ugly box. 'None' is the desirable option at the minute, but doesn't provide a good experience to my users as i'd like to give some indication that they have selected that row.

Can anyone suggest a way to show that the row is highligted, but still show the text underneath? Semi opacity?


share|improve this question
add comment

3 Answers

up vote 9 down vote accepted

Maybe it's because your sample code is setting:

artistLabel.highlightedTextColor = [UIColor clearColor];.

It will cause the artistLabel's text color become transparent when it's highlighted.

Of cause you can set your own color to your labels' highlightedTextColor property, for example:

[UIColor whiteColor]

share|improve this answer
What an absolute idiot I am, thank you. Simple answer, that worked perfectly. Thanks –  Paul Morris Aug 29 '11 at 8:34
You are welcome. If you think this answer is useful, a vote up and select it as correct answer will be very appreciated. –  xuzhe Aug 29 '11 at 8:39
I always do. I have 100% fore very question I ask. Thanks again. –  Paul Morris Aug 29 '11 at 8:50
:) Thank you, too. It's hard to keep that rate 100%, That's pretty incredible. –  xuzhe Aug 29 '11 at 9:14
add comment

UITableView Cell selected Color


// Image
UIImage *selectionBackground = [UIImage imageNamed:@"g7.png"];
UIImageView *bgview=[[UIImageView alloc] initWithImage:selectionBackground];
[bgview release];


// Color
UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor brownColor]];
[cell setSelectedBackgroundView:bgColorView];
[bgColorView release];
share|improve this answer
Cool. Color works in iOS 7. –  Twig Oct 8 '13 at 17:16
I also would recommend to call [cell setSelectionStyle: UITableViewCellSelectionStyleNone] which prevent cell from white rectangle on it perimeter when it is selected. –  Nikolay Shubenkov Feb 4 at 8:33
add comment

u can use ur own customization view to selection

here i have green color view.like this u can change whatever customization u want on that.

if (cell == nil) {

    cell = [[[UITableViewCell alloc] initWithFrame: CGRectZero 
                                   reuseIdentifier: CellIdentifier] autorelease];

    UIView *selectionView = [[UIView alloc]initWithFrame:cell.bounds];

    [selectionView setBackgroundColor:[UIColor greenColor]];

    cell.selectedBackgroundView = selectionView;

    [selectionView release];

share|improve this answer
add comment

Your Answer


