滑动表格单元格即可获得两个选项
我被困在这一点上,因为有一些信息分散在各处,但从来没有一个可靠的解释。
我有一个表格视图,其中充满了单元格和部分。我想看到当我在单元格上滑动(向右)时,我会看到两个按钮:“接受”和“拒绝”。
我已经看到删除按钮了。这种情况只发生在每个部分的第一个单元格之外的情况(这里,程序只检测 didSelectRowAtIndexPath
),而且我不知道如何在单元格中获取第二个按钮,更不用说编辑这些按钮了。
有人有什么想法吗?
I'm stuck on this bit because there is some information scattered all over, but never a solid explanation.
I've got a table view, filled with cells and sections. I'd like to see when I swipe on a cell (to the right), I get two buttons: 'Accept' and 'Reject'.
I've gotten as far as seeing the delete button. This only occurs anything but the first cell on each section (here, the program just detects didSelectRowAtIndexPath
), and I've got no clue on how getting a second button in the cell, let alone editing those buttons.
Anyone having any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要子类化 UITableViewCell 并添加 GestureRecognizer 才能获得此效果。标准的表格编辑功能在这里并不能完全解决这个问题。开源 ELCImagePickerController 在其 ELCAssetCell.m 中做了类似的事情,应该让您朝着正确的方向前进:
You'll need to subclass UITableViewCell and add a GestureRecognizer in order to get this effect. The standard table editing functionality won't quite cut it here. The open source ELCImagePickerController does something similar in its ELCAssetCell.m that ought to get you moving in the right direction: