简体   繁体   English

如何检测UITableCell上的向右滑动并显示自定义按钮而不是“删除”按钮

[英]How can I detect a right swipe on UITableCell and display a custom button instead of Delete button

I want to display a "Duplicate" button where the Delete button would usually appear if the user swipes from left to right on a UITableView cell. 我想显示一个“重复”按钮,如果用户在UITableView单元格上从左向右滑动,通常会出现“删除”按钮。 I understand I can add a gesture recogniser to the cell as per this example https://stackoverflow.com/a/6167841/2567126 . 我了解我可以按照此示例https://stackoverflow.com/a/6167841/2567126向该单元格添加手势识别器。

How do I create and place a button on the cell so that it appears in a similar manner to the Delete button to allow the user to confirm the action? 如何在单元格上创建和放置一个按钮,使其以类似于“删除”按钮的方式出现,以允许用户确认操作? The cells are just standard UITableViewCells with the default style. 单元格只是具有默认样式的标准UITableViewCells。

您可以使用委托方法- tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:来更改删除按钮的标题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让 iOS 在 tableView 上显示删除按钮,但不允许从右侧完全滑动删除 - How can I get iOS to show a delete button on a tableView, but not allow a full swipe from the right to delete 如何禁用默认的删除滑动操作并改为显示我的自定义滑动操作? - How do I disable the default Delete swipe action and display my custom swipe action instead? 检测UITableView上的删除按钮(滑动以删除)的关闭 - Detect closing of delete button (Swipe to delete) on UITableView 当我在单元格上从右向左滑动时,UITableviewcell删除按钮会增加 - UITableviewcell delete button apprearing when I swipe right to left on a cell 如何以编程方式将按钮定位在UITableCell的最右边缘? - How to position a button to right most edge of UITableCell with a margin programatically? 如何在交换事件上更改UITableCell中删除按钮的文本 - how to change the text of delete button in a UITableCell on swap event iOS:如何在viewForHeaderInSection中添加滑动以删除按钮到自定义视图 - iOS: How to add swipe to delete button to a custom view in viewForHeaderInSection 滑动删除按钮的自定义高度 - custom height for swipe delete button swift 如何在 swift 5 中实现滑动中的两个垂直按钮以删除 - How can implement two vertical button in swipe to delete in swift 5 如何在 ios 中实现两个垂直按钮在滑动中删除? - How can implement two vertical button in swipe to delete in ios?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM