ios - 如何更改tableView中分隔符的颜色?

标签 ios swift uitableview

我目前正在 TableViewCell 中创建 collectionView 单元格,但我想使用默认分隔符分隔每个 TableViewCell 但更改其颜色。请在这件事上给予我帮助。或者我可以删除所有分隔线并使用自定义 UIView 来分隔它们吗?

最佳答案

只需使用所需的 UIColor 实例更新 tableViewseparatorColor 属性即可。

tableView.separatorColor = .red

如果你想通过 storyboard 更新它,你可以使用 tableView 的 attributes inspector,比如,

enter image description here

关于ios - 如何更改tableView中分隔符的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56847509/

相关文章:

ios - 如何查找在 Swift 的 NSURLSession 中读取了多少字节?

swift - 为什么是x? = y Swift 中的有效语法?

ios - UITableView headerView 大小不同

ios - UITableView "bulk select"未在选择圆圈中显示选定的复选标记,显示右侧复选标记而不是左侧

ios - Ionic Pro- iOS 构建代码签名

iphone - UITableView 中的 "mini-map"

ios - 如何在 Swift 中使用 htonl 设置整数字节序?

ios - 如何仅在特定条件下通过 UIViewController 呈现 UITableView 类似于 Google map 搜索选项

ios - UITableViewCell 约束未更新

ios - mergeChangesFromContextDidSaveNotification 后的 KVO 通知