开发者

Change the width of the cell content

I want to change the width of the cell content. (see the pic) alt text http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/Art/tv_cell_pa开发者_运维百科rts.jpg

My code:

 CGSize contentViewSize = cell.contentView.bounds.size;
    contentViewSize.width = 20.0f;

But there is no effect, what's wrong?

Any suggestion will be appreciated, thanks.


You need to re-assign the frame for the cell's contentView.

CGRect oldFrame = cell.contentView.frame;
cell.contentView.frame = CGRectMake( oldFrame.origin.x,
                                     oldFrame.origin.y, 
                                     oldFrame.size.width + 20, 
                                     oldFrame.size.height );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜