美文网首页
cell的分割线

cell的分割线

作者: 王强iOS | 来源:发表于2016-08-16 11:05 被阅读42次

// 处理cell分割线 1.自定义分割线 2.系统属性(iOS8才支持) 3.万能方式(重写cell的setFrame) 了解tableView底层实现了解 1.取消系统自带分割线 2.把tableView背景色设置为分割线的背景色 3.重写cell的setFrame

万能方式:

1.取消系统自带分割线

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

2.把tableView背景色设置为分割线的背景色

self.tableView.backgroundColor = XMGColor(220, 220, 221);

3.重写cell的setFrame

- (void)setFrame:(CGRect)frame

{

XMGLog(@"%@",NSStringFromCGRect(frame));

frame.size.height -= 1;

// 才是真正去给cell赋值

[super setFrame:frame];

}

相关文章

网友评论

      本文标题:cell的分割线

      本文链接:https://www.haomeiwen.com/subject/fgrpsttx.html