在一个UITableViewCell上隐藏分隔符线 [英] hide separator line on one UITableViewCell
本文介绍了在一个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上隐藏分隔符线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文