本文介绍了在一个UITableViewCell上隐藏分隔符线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我自定义一个Tableview .. 我想隐藏最后一个单元格上的行分隔...我可以这样做吗? 我看到这是UITableView的属性,但我想只在一个特定的单元格工作。
i'm customizing a Tableview .. I want to hide the line separating on the last cell ... can i do this? I saw that this is a property of the UITableView but I would like work only on a particular cell.
推荐答案在 viewDidLoad 中,添加此行:
self.tableView.separatorColor = [UIColor clearColor];和 cellForRowAtIndexPath :
if(indexPath.row != self.newCarArray.count-1){ UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, 44, 320, 2)]; line.backgroundColor = [UIColor redColor]; [cell addSubview:line]; }
适用于iOS 7上层版本(包括iOS 8)
for iOS 7 upper versions (including iOS 8)
if (indexPath.row == self.newCarArray.count-1) { cell.separatorInset = UIEdgeInsetsMake(0.f, cell.bounds.size.width, 0.f, 0.f); }更多推荐
在一个UITableViewCell上隐藏分隔符线
发布评论