开发者

Uitableview in editing mode: how to add both the "+" (add) and "-" (delete) buttons at the same time?

Is it possi开发者_JAVA技巧ble to have a uitableview that when in editing mode it shows both the red button ('-') and the green button (+) I wanted to do so I can either delete a row or duplicate it.


You can set such a view for

Look through UITableViewCell class reference. There is an editingAccessoryView propery that is most suitable for that particular case:

http://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html#//apple_ref/occ/instp/UITableViewCell/editingAccessoryView

I'd use a UISegmentedControl with "+" and "-" images for the purpose you've mentioned.


No, to display both you would need to make one of them a custom control.

Probably the best approach is to make a custom cell and add an additional button to the left or right of where the red '-' button usually appears. You can then use a custom graphic that mimics the green '+' button and set it up to trigger on tap.

If you only want it to show in edit mode you can selectively show/hide it based on that too.

The end result will be cells with + buttons and - buttons next to each other.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜