前言:如果项目中遇到自定的cell,样式如下,你会怎么做呢?

第一种方法(不推荐,麻烦,而且还交互性不好)
定义UITableView的颜色为灰色,cell的颜色为灰色,定义cell的高度为70,然后在自定义的UITableViewCell里定义一个底部的View,颜色为白色,左右间距为10,上下间距为1,宽高各减少4。
第二种方法(重写cell的坐标)
在自定义的UITableViewCell里重写坐标,调用系统方法
-(void)setFrame:(CGRect)frame{
frame.origin.x = 10;
frame.size.width -= 2* frame.origin.x;
frame.size.height -= 1;
[super setFrame:frame];
}
网友评论