0

At the end of my UITableViewCell, I have a line of pixel that I cannot remove. The line will change color as the cell is selected. It also changes color according to my selectionStyle. Here is a screenshot demostrating this problem.

alt text http://img33.imageshack.us/img33/2383/picture1nki.png

The cell is created with interface builder. 2 images are set as the background, one for selected, one for non-selected.

Any ideas how to remove that line?

erotsppa
  • 14,248
  • 33
  • 123
  • 181

3 Answers3

0

Strange... It looks like it is just one pixel to the left. If you have verified the image sizes then maybe just try extending it further out to see if it covers it. It appears to me that the default blue selection is showing through. This either means that the image is not big enough or the over state actually moves the image slightly to have the appearance of selection. It also looks like it might be a border.

You might also look at using contentView to fully customize the cell.

If it is a border issue your answer is in this thread: How to customize the background/border colors of a grouped table view cell?

Community
  • 1
  • 1
Ryan Christensen
  • 7,843
  • 1
  • 27
  • 25
  • I have already checked the images, they are 320. I even tried setting them to wider, doesn't help. What do you mean by using contentView. Any example? – erotsppa Jul 16 '09 at 14:11
  • Yeh it has to be a border thing. Maybe change the selected color to black so it doesn't show the default blue. For the contentView here is a custom UiTableViewCell sample: http://idevkit.com/forums/tutorials-code-samples-sdk/30-custom-uitableviewcell.html – Ryan Christensen Jul 16 '09 at 14:47
  • How do you set selected color? I can only find selection style, and there's only three choice, blue grey or none. In the case of none, no selection is allowed including my own images. What exactly am I looking for in the contentView. I am familiar with writing the contentView programtically, but just not sure what to change to overcome this. – erotsppa Jul 16 '09 at 15:01
  • Try grey just for giggles. I read elsewhere that this solved someones issue with select state. You can change all the colors and specifics only with a custom view. – Ryan Christensen Jul 16 '09 at 15:16
0

Yeah, as Ryan says, it looks like you haven't quite set the correct size for the width of the selected cell row image. The blue line you're seeing is the default blue UITableViewCellSectionStyle... You can also try and force it to 'None' in your code:

cell.selectionStyle = UITableViewCellSelectionStyleNone;

Although I would think you're still going to have that gap.

From what I can see, nice graphics :)

runmad
  • 14,846
  • 9
  • 99
  • 140
  • Setting UITableViewCellSelectionStyleNone will ignore the image on selection property all together (i.e. click it will not show another image). And thanks :) – erotsppa Jul 16 '09 at 14:09
0

Maybe because positioning using non-rounded floats? Might be a good idea to round to the nearest integer/pixel.

Or you have something in your drawRect method that should not be there? Had an issue like this recently.

Dylan
  • 181
  • 3
  • 12