隐藏单个单元格的 UITableViewCell 分隔符 [英] Hiding UITableViewCell separator for individual cells
问题描述
我的大部分单元格需要 UITableViewCell 分隔符,但其中一些应该隐藏.
I require a UITableViewCell separator for the majority of my cells, but some of them should be hidden.
设置方式是self.tableView.separatorStyle
,适用于每个单元格.
The way this is set is self.tableView.separatorStyle
, which would apply to every cell.
一个繁琐的解决方法是禁用它,然后将其作为 UIView 手动绘制到单元格上,但我不想去那里.
A heavy-handed work around is to disable it, and then draw it onto cells manually as a UIView, but I don't want to go there.
我如何才能移除单个单元格的分隔符?
How can I otherwise remove the separator for individual cells?
推荐答案
您可以自定义单元格并在该单元格中添加分隔符,这样您就可以管理您的单元格分隔符.或者你可以addSubView
一个UIView
作为你的单元格的分隔符,比如iPatel的答案,但要注意内存问题.
You can have custom cell and add separator in this cell, this way you can manage your cell separator. Or you can addSubView
a UIView
for separator to your cell like iPatel's answer, but be careful for memory issue.
这篇关于隐藏单个单元格的 UITableViewCell 分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!