Here is my code of slide show of images:
-(void)setImage
{
imageView.image = [UIImage imageNamed:[arrImages objectAtIndex:0]];
[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(changeImage) userInfo:nil repeats:YES];
}
-(void)changeImage
{
imageId = imageId + 1;
int id = imageId % [arrImages count];
CATransition * trs = [CATransition animation];
trs.duration = 0.5;
[trs setType:kCATransitionPush];
imageView.image = [UIImage imageNamed:[arrImages objectAtIndex:id]];
[imageView.layer addAnimation:trs forKey:kCATransition];
}
i am calling setImage() method on button click.
first time when i am clicking on button it works fine but after that whenever i click on button, speed of slideshow increases.
Can any one tell me why this happens.
Thanx.