Ios 我想在每个可以移动的图像上设置点击手势,但不是在每个图像上都设置了该手势

Ios 我想在每个可以移动的图像上设置点击手势,但不是在每个图像上都设置了该手势,ios,Ios,我想在点击“添加”按钮时添加UIImageView,并想在每个可以移动的图像上设置点击手势,不知何故,我添加了图像,但并没有在每个图像上设置手势 用于添加图像 触摸法 在gestureMethod中,我编写了运动图像和放大缩小的代码实际上,点击手势在任何单个事件中都有效,而不是一个多个u需要多个为每个图像分配单独的手势,在我的选择中,在此处分配按钮并获取索引简单的“不了解您的问题?”?你到底想要什么? -(IBAction)addImageAction:(id)sender{ if (fla

我想在点击“添加”按钮时添加UIImageView,并想在每个可以移动的图像上设置点击手势,不知何故,我添加了图像,但并没有在每个图像上设置手势

用于添加图像 触摸法
在gestureMethod中,我编写了运动图像和放大缩小的代码

实际上,点击手势在任何单个事件中都有效,而不是一个多个u需要多个为每个图像分配单独的手势,在我的选择中,在此处分配按钮并获取索引简单的“不了解您的问题?”?你到底想要什么?
 -(IBAction)addImageAction:(id)sender{

if (flag == true) {
    imgNew = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
    flag = false;
}else{
    imgNew = [[UIImageView alloc]initWithFrame:CGRectMake(imgNew.frame.origin.x+15, imgNew.frame.origin.y+15, 70, 70)];
}

[imgViewArray addObject:imgNew];
[viewMain addSubview:imgNew];
[imgNew setUserInteractionEnabled:YES];
[imgNew setImage:[UIImage imageNamed:@"Doraemon.png"]];
[self gestureMethod];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *touch = [touches anyObject];

if ([touch view] == img1)
{
    NSLog(@"its 1st image");
    // set imageview to 1st image
     img = img1;
}else if ([touch view] == img2){
    NSLog(@"its second image");
     // set imageview to 2nd image
     img = img2;
}else {
    img = imgNew;
}
[self gestureMethod];
NSLog(@"%@",touch.view.description);

}