func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
tableView.separatorColor = UIColor.clear
} else {
tableView.separatorColor = UIColor.blue
}
}
我有上面的代码,只改变第一行的分隔符颜色。但是,整个部分本身使用了清晰的分色符,而不是蓝色。你能帮我拿一下这个吗?任何帮助都将不胜感激。谢谢。
发布于 2017-12-05 04:59:14
不要使用tableview默认分隔符。
tableView.separatorColor = UIColor.clear or tableView.separatorStyle = .none
在UITableViewCell
中添加一个1px高度的UIView
,给它任何你想要的颜色。如果所有的表行都使用相同的UITableViewCell
,那么您可以使用类似于-
seperatorView.hidden = indexPath.row != 0
https://stackoverflow.com/questions/47639779
复制相似问题