【发布时间】:2020-06-06 18:43:32
【问题描述】:
我在 macOS Catalina 上使用 Swift 5 和 Xcode 11.4.1。
我用了这个方法:
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { //code }
使单元格可滑动。
然后,我用下面的代码使边框变圆。
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = arr[indexPath.section]
cell.backgroundColor = UIColor.white
cell.layer.borderColor = UIColor.gray.cgColor
cell.layer.borderWidth = 1
cell.layer.cornerRadius = 10
cell.clipsToBounds = true
return cell
}
取消滑动特定单元格后(在下图中,我对第二个单元格进行了滑动),圆角变为方形边框。
【问题讨论】:
标签: ios swift xcode uitableview