views:

727

answers:

1

I'm currently looking for a way to provide the user with being able to select multiple items from a collection of values.

I know this is done in the mail app whereby you can go into the edit mode of a folder and select multiple items by clicking on the circle on the left hand side.

What I'm unsure about is how this is achievable. Is anyone familiar with how to reproduce such functionality?

Thanks, Matt Delves

+2  A: 

The easiest way is this:

  1. Provide a UITableView with all values the user can select.
  2. Keep a mutable array with one object (e.g. an NSNumber) per table row to store each row's selection state.
  3. In tableView:didSelectRowAtIndexPath:, toggle the selection state in your array for the tapped row and set the tapped cell's accessory type to checkmark or none, depending on the selection state.
Ole Begemann
Could you please expand on this to let me know how I present the option for selecting.
Matt Delves
If you don't know how to build a table view, you should read the documentation (start with the Table View Programming Guide). Then, if you have further questions, you should ask another question.
Ole Begemann