UIImageViewsがありuserInteractionEnabled
、現在タップしている画像で知りたいです。それを知るために私は何をすべきですか?私はポスターの壁とそのためのクラスをThumbPosterModel
持っています。そこに私が通過したいすべてのポスター情報があります。
だから私のコードは:
for (ThumbPosterModel *tPoster in _thumbsPosterStack) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:tPoster.thumb];
imageView.userInteractionEnabled = YES;
imageView.frame = CGRectMake(i, imageView.frame.origin.y, imageView.frame.size.width, imageView.frame.size.height);
[_posterWallScrollView addSubview:imageView];
UITapGestureRecognizer *tap =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)];
[imageView addGestureRecognizer:tap];
}
そして、私は持っています:
-(IBAction)imageTapped:(id)sender {
//something do here, but know i don't know what.
}
UIImageView
すべてのThumbPosterModelパラメータを含む必要があるサブクラスを作成する必要がありますか?それは良い考えではないと思いますが、他の解決策を見つけることはできません。