0
我做我的应用程序这个滑动画廊:IOS滚动画廊
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(photoTap:)];
tap.numberOfTapsRequired = 1;
int pageCount = 3;
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,
0,
360,
200)];
scrollView.backgroundColor = [UIColor clearColor];
scrollView.pagingEnabled = YES;
scrollView.contentSize = CGSizeMake(pageCount*scrollView.bounds.size.width ,
scrollView.bounds.size.height);
[scrollView addGestureRecognizer:tap];
CGRect viewsize = scrollView.bounds;
UIImageView *image = [[UIImageView alloc]initWithFrame:viewsize];
[image setImage: [UIImage imageNamed:@"01.png"]];
image.userInteractionEnabled = YES;
[scrollView addSubview:image];
viewsize = CGRectOffset(viewsize, scrollView.bounds.size.width, 0);
UIImageView *image2 = [[UIImageView alloc]initWithFrame:viewsize];
[image2 setImage: [UIImage imageNamed:@"02.png"]];
image2.userInteractionEnabled = YES;
[scrollView addSubview:image2];
- (void)photoTap:(UITapGestureRecognizer *) gestureRecognizer{
}
我如何检测其照片在我的滚动视图挖? 我试图添加手势识别器的图像,但只有最后一个工程。 有什么建议吗?谢谢
手势识别器已被添加到滚动视图。 – rmaddy