How can I improve my code here, that has an array of image to have/assign a specific integer,value or number. that whenever it is displayed I can draw a circle on it programmatically. Could anyone suggest a way?
- (void)awakeFromNib
{
if (self) {
self.images = [NSMutableArray arrayWithObjects:@"111.jpg",
@"112.jpg",
@"113.jpg",
@"114.jpg",
@"115.jpg",
@"116.jpg",
@"117.jpg",
@"118.png",
@"119.jpg",
@"120.jpg",
nil];
}
}
Create an array of NSDictionaries (instead of strings) and each dictionary can contain a key for the image name plus whatever other keys you want to add. Or even better, create an array of your own custom object (subclass NSObject) and then you can access the properties of each entry in the array without having to do a dictionary lookup.
Here is some sample code for the NSDictionary method: