Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITableView滑动单元格';边界_Ios_Swift_Xcode_Uitableview - Fatal编程技术网

Ios UITableView滑动单元格';边界

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

我在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
}
取消滑动特定单元格后(在下图中,我使用了第二个单元格),圆角变为方形边框


只需替换以下代码行:

 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

谢谢你,先生。你救了我的命!谢谢你,先生。你救了我的命!除息的