Search code examples
uitableviewselectionallowmultiple

iOS5 - Limit allowsMultipleSelection


I need to limit the number of multiple selection in a Table View, but I don't have any idea for where can I begin.

Thanks and regards!


Solution

  • Create a NSMutableArray. Whenever someone selects a cell, check the number of items already in the array. If it's less than your limit, put a reference to that cell's backing data into your array. If it has reached its limit, either ignore the selection or replace a previous selection...whichever makes sense for your app.