您的位置:首页 > 产品设计 > UI/UE

UITableView 分割线不靠左(未补全),删除多余分割线问题

2015-11-21 16:54 411 查看

1.分割线不靠左(未补全)问题

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)])
{
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)])
{
[cell setPreservesSuperviewLayoutMargins:NO];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)])
{
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}

图片中可以看到多出了几条空白Cell的分割线,在cellForRowAtIndexPath:中添加以下代码

[tableView setTableFooterView:[[UIView alloc]initWithFrame:CGRectZero]];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: