Ios UITableView滑动单元格';边界
我在macOS Catalina上使用Swift 5和Xcode 11.4.1 我用了这个方法:Ios UITableView滑动单元格';边界,ios,swift,xcode,uitableview,Ios,Swift,Xcode,Uitableview,我在macOS Catalina上使用Swift 5和Xcode 11.4.1 我用了这个方法: override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { //code } 使手机可以滑动 然后,我用下面的代码将边界四舍五入 override func
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
}
取消滑动特定单元格后(在下图中,我使用了第二个单元格),圆角变为方形边框
只需替换以下代码行:
cell.contentView.layer.borderColor = UIColor.gray.cgColor
cell.contentView.layer.borderWidth = 1
cell.contentView.layer.cornerRadius = 10
cell.contentView.clipsToBounds = true
只需替换以下代码行:
cell.contentView.layer.borderColor = UIColor.gray.cgColor
cell.contentView.layer.borderWidth = 1
cell.contentView.layer.cornerRadius = 10
cell.contentView.clipsToBounds = true
谢谢你,先生。你救了我的命!谢谢你,先生。你救了我的命!除息的