如何在 swift 3 的表格视图中删除特定单元格的按钮

how to remove a button for a particular cell in tableview in swift 3

我有一个 table 视图,其中单选按钮编辑和删除按钮放置在特定的 table 视图中,其中键值对 default_shipping 为真然后删除按钮应该被隐藏,编辑按钮需要移动到那个地方,在这里用户可以通过单击编辑按钮来更改默认地址,并且可以将另一个地址设为默认地址,这样所选地址应该只有编辑按钮,编辑按钮应该放在删除按钮的位置谁能帮我实现这个?

  • 将编辑按钮的尾部约束赋予 contentView 而不是 删除按钮。
  • 移除 UITableViewCell 中编辑按钮的尾随约束 class

cellForRowAtIndexPath中使用以下代码:

if indexPath.row == "your default_shipping cell's indexPath.row" {

editButtonTrailing.constant = 8 

} else {

editButtonTrailing.constant = space between delete and edit button.  

}