How can I select multiple rows in UITableView

2019-02-20 00:23发布

问题:

I want to display some selected contacts in a list and then I need a feature to select multiple contacts at a time and then on clicking a button it should trigger an email to the selected contacts.

For this I am using UITableView to display the contacts but I am not able to find any way to unable the multiple selection for UITableView. On doing some google search I found that UITableView does not support multiple selection.

Is there any way to select multiple rows in UITableView or which control should I use for this purpose.

Thanks in advance.

Gaurav

回答1:

Check the Apple's Sample Code for this http://developer.apple.com/library/ios/#samplecode/TableMultiSelect/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011189-Intro-DontLinkElementID_2



回答2:

Yes. Please check the following link for more details http://cocoawithlove.com/2009/01/multiple-row-selection-and-editing-in.html



回答3:

You can use cellAccessorytype for selecting a row when finished with the selection. Just check which cell has accessory mark, put that content into the array and use them.



回答4:

If you want to use or are allowed to use undocumented classes, check out http://www.iphonedevwiki.net/index.php?title=UITableView - it looks a ton more native.