找到你要的答案

Q:Hide individual UITableViewCell separator

Q:隐藏个人UITableViewCell分离器

Apart from removing all UITableViewCell separators using tableView.separatorStyle = .None or offsetting the individual separator using cell.separatorInset = UIEdgeInsetsMake(0.0, 4500.0, 0.0, 0.0) is there a way to remove a cells separator?

The first method affects all of the cells and the second method seems far too hacky, is there a better way to do this?

除了去除tableview.separatorstyle =所有UITableViewCell分离器。没有或抵消使用cell.separatorinset = uiedgeinsetsmake个人分离器(0,4500,0,0)有没有办法移除细胞分离器?

第一种方法会影响所有的细胞和第二方法似乎太容易了,有没有更好的方法来做这件事吗?

answer1: 回答1:

To my knowledge this is the right way of doing it. You could use a custom cell to manage your own borders but that too would be like adding a border view and controlling it for the cells you want. To me, this is not a hack. There is no direct way given by Apple to do this but you can always utilise your language knowledge!

据我所知,这是做这件事的正确方法。您可以使用一个自定义单元格来管理自己的边框,但这也将像添加边框视图,并为需要的单元格控制它。对我来说,这不是一个黑客。苹果没有直接的方式做到这一点,但你可以随时利用你的语言知识!

answer2: 回答2:

Or you can add a subview in your custom cell as a seperator and hide/show as you like

或者你可以添加自定义单元的子视图作为一个分离器和你喜欢隐藏/显示

answer3: 回答3:

I think you did right, no other way.

我认为你做得对,没有其他办法。

ios  swift  uitableview  swift2