What's the difference?
In my context, I need to be able to dynamically add to and remove objects. The user clicks on rows of a table that check on and off and thus add or remove the referenced object from the list.
A wild guess is that array has indexed items while set has no indexes?
-
An
NSSet/NSMutableSetdoesn't keep items in any particular order. AnNSArray/NSMutableArraydoes store the items in a particular order. If you're building a table view, you should definitely use an array as your data source of choice. -
Also, NSMutableSet makes sure that all objects are unique.
NSMutableArray goes well with UITableView since elements have index, so you can return [array count] to get number of table rows, or [array objectAtIndex:rowNumber] to easily associate element with row.
Brenden : This is something I didn't realize
0 comments:
Post a Comment