Do the 4 step dance (Declare, @property, @synthesize, [release]
) And declare an NSArray.
NSArray* imagesArray;
@property (retain,nonatomic) NSArray *imagesArray;
@synthisize imagesArray;
//In your dealloc method relase the vairable***
imagesArray = [NSArray arrayWithObjects:[UIImage imageNamed:@""]];//Some initialization if you want :)
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html#//apple_ref/occ/cl/NSMutableArray
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html
NSMutableArray defines an instance method - (void)addObject:(id)anObject
to add things to your images array. You can then use - (void)removeObject:(id)anObject
to remove the object. You would set these up by linking the buttons you want to have add and remove to respective methods that would perform these actions.
-(void)addImageBtnAction:(id)sender
-(void)removeImageBtnAction:(id)sender
Use these two methods (you can call them what ever you want) and when setting up the buttons (I do it all in code) set it's action to the corresponding Action event method you wrote. You can also link up the buttons through interface builder but I find that to be more trouble than it is worth and rather do it all programmicly so I can't show you how to use the IB way.
And forgot to add, adding the images to the view, have it get it's objects from the defined NSArray and refresh the view when adding or deleting.