Adding a subview larger than cellHeight to a UITableViewCell?

Posted by MathieuK on Stack Overflow See other posts from Stack Overflow or by MathieuK
Published on 2010-05-16T07:47:34Z Indexed on 2010/05/16 7:50 UTC
Read the original article Hit count: 187

Filed under:
|
|

I'm trying to add a subview to a UITableViewCell and the design that I'm working from demands that this particular subview (an image) needs to be larger than the actual UITableViewCell and thus partly overlap its siblings.

So I've set up my table cell, generated my image and added it to the cell's contentView:

// rowHeight for the UITableView is 45.0f

UIImage *image = [self createCellThumbnail: someImage];
UIImageView *thumbView = [[UIImageView alloc] initWithFrame: CGRectMake(150, -5, 55,55)];
thumbView.transform = CGAffineTransformMakeRotation(0.1f);
thumbView.image = image;

cell.clipsToBounds = NO;
cell.contentView.clipsToBounds = NO;

[cell.contentView addSubview: thumbView];

While the image will 'overflow' into the cell below it, the top of the image is always clipped, as demonstrated here: http://imgur.com/WDsAx .

Does anyone know if what I'm trying to do is possible with the current approach or should I just figure out a way to draw these images onto the UITableView after all the cells are drawn (it's a non-scrollable tableview, so that would work and be fairly easy).

© Stack Overflow or respective owner

Related posts about uitableviewcell

Related posts about clipping