I have 4 images. I want to load image in first screen and change images after every 10 second. when we click any images than next screen come up.
开发者_Python百科please give me help i am new in iPhone.
Use NSTimer to trigger the image change. If the user taps an image and you want to stop the image rotation, you can invalidate the timer before switching to the next view.
You can try by creating a method that changes the image in the imageView and calling it using a NSTimer
which repeatedly calls the method every 10 seconds.
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(changeImage) userInfo:nil repeats:YES];
- (void)changeImage {
// Change image here
}
HI Avinash,
I think you need below code...
******* IN VIEW DID LOAD
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(changeImage) userInfo:nil repeats:YES];
- (void)changeImage {
[self.imgview setImage:[UIImage imageNamed:@"test.png"]];
}
Thx
精彩评论