|
|
10分 |
UIGestureRecognizer *singleTap = [[UIGestureRecognizeralloc]initWithTarget:selfaction:@selector(UeserClicked:)]; imageView.userInteractionEnabled = YES; [imageView addGestureRecognizer:singleTap]; -(void)UeserClicked:(UIGestureRecognizer *)sender { uiimageview *imageView = sender.view; } |
本人新手额、、能不能稍微讲的详细些 报错 |
|
|
|
20分 |
给这个UIImageView实例添加UITapGestureRecognizer 手势
但需要先设置UIImageView 支持交互 imgvw.userInteractionEnable = YES; //////给imageView添加手势 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imgPressed:) ]; [imgvw addGestureRecognizer:tap]; -(void)imgPressed:(UIGestureRecognizer *)gestureRecognizer { ////to do your logic } |
10分 |
你这个地方出问题,是因为 initWithTarget: action:之间是有空格的。 |