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 姐姐生日祝福语漂亮简短
18 步入新工作祝福语简短