iOS应用开发中UITableView的分割线的一些设置技巧
对于ios7,ios8及以上来说,调整UITableView的cell的分割线位置已经是相当不便,因为UITableView内部使用了marginlayout.
其实只需要如下这样子就可以实现分割线的控制。
-(void)tableView:(UITableView)tableViewwillDisplayCell:(UITableViewCell)cellforRowAtIndexPath:(NSIndexPath*)indexPath
{
//下面这几行代码是用来设置cell的上下行线的位置
if([cellrespondsToSelector:@selector(setLayoutMargins:)]){
[cellsetLayoutMargins:UIEdgeInsetsZero];
}
//按照作者最后的意思还要加上下面这一段,才能做到底部线控制位置,所以这里按stackflow上的做法添加上吧。 if([cellrespondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){ [cellsetPreservesSuperviewLayoutMargins:NO]; } }
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短