In an iPhone app, the User can create Items – each Item needs to have a CGPoint, NSString and a few integers with information about it. The User can keep adding these Items.
How can I store all these variables for each of the Items and programmatically keep adding them to a list or array or something?
I tried using a struct array but it can’t hold a NSString. I tried using a NSMutableAray of a custom class, but I can only add them if I make and name them by hand.
Any suggestions, ideas? Could I use a NSDictionary?
Create an
Itemclass, that contains yourCGPoint,NSString, and any other piece of info you want. Then, make anNSMutableArrayand add new instances of yourItemclass as you see fit.NSDictionaryandNSArrayaren’t really what you’re looking for.