views:

145

answers:

3

I'm not sure what might be causing this, but UIImageView occasionally clips off about a pixel or 2 from the bottom of some square/rectangular UIImages I'm using as subviews for UITableViewCells. These UIImageViews are well within the borders of the cell, so it shouldn't be due to cliptobounds. There seems to be no consistency or pattern to which images are being clipped, nor when they're clipped, other than that it only happens to (or is only noticable in) square/rectangular icons, and only ones that are parented to UITableViewCells (or their subclasses). I'm having trouble reproducing the problem consistently, which is why I haven't posted any code this time.

Has anyone encountered something similar to this before?

I've encountered a similar bug that involved floating point values for origin/size being interpreted weirdly... but that doesn't seem to be the cause of this particular problem.

I don't need a specific solution at this point, I'm just making sure I haven't missed any well-known bugs or documented problems that involve UIImageView.

A: 

Maybe not UIImageView is the cause?

If you have an image in UITableViewCell and you don't at least 5 pixels "free space", the UITableViewCell may not look as it should be.

Try to set the rowHeight when you're initializing the table. For ex:

self.tableView.rowHeight = 60;

If this does't solve the problem, pls provide mode details.

mxg
A: 

If it's any boost to your self-confidence, I can affirm that I see the same thing happen. I think it has to do with floating point rounding .... but I don't know yet what causes it. Did you make any progress on this?

tjsbbi
It seems to be an anti-aliasing problem. There doesn't seem to be a way to avoid it completely... The best I've been able to do is to truncate/round-off all x,y,w,h values to integers, so that post-anti-aliasing, the results are consistent.
akaii
A: 

I had the same problem but strangely enough only with the imageViews in the header cells. The fix in my case was to set the contentMode of the image view and everything looked the way you would expect.

imageView.contentMode = UIViewContentModeTop;

Dave