I have images in a array but it return the NULL
I have use this code
- (void)viewDidLoad
{
[super viewDidLoad];
images= [[NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
nil] retain];
}
-(IBAction)Next
{
currentImage++;
if(currentImage >= [images count])
{
currentImage=0;
}
UIImage *img=[images objectAtIndex:currentImage];
[animalphoto setImage:img];
NSLog(@"print:%@",currentImage);
}
first time click button images display but second time not display image and that return NULL value.. give any suggestion and source code which is apply in our code.