I have deal with this problem, I have been solved it by MVC design pattern, I created Card class:
@interface Card : NSObject
@property (strong,nonatomic) UIImage* img;
@property (strong,nonatomic) NSString* url;
@end
//then in the UIViewController
in the DidLoad
Method to Do :
// init Cards
Card* card10= [[Card alloc]init];
card10.url=@"image.jpg";
card10.img = [UIImage imageNamed:[card10 url]];
// for Example
UIImageView * myImageView = [[UIImageView alloc]initWithImage:card10.img];
[self.view addSubview:myImageView];
//may you want to check the image name , so you can do this:
//for example
NSString * str = @"image.jpg";
if([str isEqualToString: [card10 url]]){
// your code here
}