我们可以为 a 指定 images 数组UIImageview
,它会很好地为图像设置动画。我已经对这个类进行了子UIImageView
类化。
现在,当用户单击图像时,我捕获了点击手势,但问题是我如何知道单击了动画图像中的哪个图像?
- (void)setup
{
self.animationImages = self.bannerImagesArray;
self.animationDuration = 3.0f;
self.animationRepeatCount = 0;
[self startAnimating];
self.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageClicked)];
[self addGestureRecognizer:tapGesture];
}
- (void)imageClicked
{
NSLog(@"Image clicked");
// How do i detect which image was clicked here
}