转载自: http://blog.youkuaiyun.com/andyweike/article/details/6131507
5. 给UITableViewCell的成员设置框架属性后不起作用,解决办法是在UITableViewCell的子类中重写layoutSubviews,在其中改变一些属性的值,例如下:
- (void)layoutSubviews {
[super layoutSubviews];
self.imageView.bounds = CGRectMake(0,0,75,75);
self.imageView.frame = CGRectMake(0,0,75,75);
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
CGRect tmpFrame = self.textLabel.frame;
tmpFrame.origin.x = 77;
self.textLabel.frame = tmpFrame;
tmpFrame = self.detailTextLabel.frame;
tmpFrame.origin.x = 77;
self.detailTextLabel.frame = tmpFrame;
}
http://stackoverflow.com/questions/3130804/changing-bounds-of-imageview-of-uitableviewcell
本文介绍了一个UITableViewCell布局调整的问题及解决方案。通过在UITableViewCell的子类中重写layoutSubviews方法,并调整imageView和其他UILabels的位置来实现自定义布局。适用于需要对单元格进行精确控制的iOS开发者。

被折叠的 条评论
为什么被折叠?



