开发者

Swipe a table cell to get two options

开发者 https://www.devze.com 2023-03-02 06:27 出处:网络
I\'m stuck on this bit because there is some i开发者_如何学Cnformation scattered all over, but never a solid explanation.

I'm stuck on this bit because there is some i开发者_如何学Cnformation 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?


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:

[elcAsset addGestureRecognizer:[[[UITapGestureRecognizer alloc] initWithTarget:elcAsset action:@selector(toggleSelection)] autorelease]];
0

精彩评论

暂无评论...
验证码 换一张
取 消