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 生日广州男生祝福语简短