在一个UITableViewCell上隐藏分隔符线

编程入门 行业动态 更新时间:2024-10-25 10:32:18
本文介绍了在一个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上隐藏分隔符线

本文发布于:2023-10-16 10:22:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497296.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分隔符   UITableViewCell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!