Iphone 在UIScrollView的UIImageView中检测触摸
我的UIScrollview中有图像,它已添加到视图中。 请检查一下我的密码- 这很好,但仅适用于阵列中的最后一个图像 ToucheSBegind不适用于阵列中的其他图像Iphone 在UIScrollView的UIImageView中检测触摸,iphone,iphone-sdk-3.0,uiscrollview,uiimageview,touch,Iphone,Iphone Sdk 3.0,Uiscrollview,Uiimageview,Touch,我的UIScrollview中有图像,它已添加到视图中。 请检查一下我的密码- 这很好,但仅适用于阵列中的最后一个图像 ToucheSBegind不适用于阵列中的其他图像 我应该在这里添加什么来检测阵列的所有图像1st、2nd等的触摸您知道UIScrollview上图像的所有位置,因此您可以将scrollView上的位置触摸到阵列中的图像位置。 还有一点-您不应该使用==比较objective-c对象,而应该使用isEqual方法。您知道UIScrollview上图像的所有位置,因此可以将scr
我应该在这里添加什么来检测阵列的所有图像1st、2nd等的触摸您知道UIScrollview上图像的所有位置,因此您可以将scrollView上的位置触摸到阵列中的图像位置。
还有一点-您不应该使用==比较objective-c对象,而应该使用isEqual方法。您知道UIScrollview上图像的所有位置,因此可以将scrollView上的位置触摸到数组中的图像位置。
还有一点-您永远不应该使用==比较objective-c对象,而应该始终使用isEqual方法。这是因为您不断更新变量productImage,将代码更改为read
UIImageView *imageInstance=[[UIImageView alloc]initWithImage:[UIImage imageNamed:[[productArray objectAtIndex:i]objectForKey:@"ProductImage"]]];
imageInstance.frame=CGRectMake(95, 35+i*125, 100, 100);
[imageInstance setUserInteractionEnabled:YES];
[self addSubview:imageInstance];
这是因为您不断更新变量productImage,将代码更改为read
UIImageView *imageInstance=[[UIImageView alloc]initWithImage:[UIImage imageNamed:[[productArray objectAtIndex:i]objectForKey:@"ProductImage"]]];
imageInstance.frame=CGRectMake(95, 35+i*125, 100, 100);
[imageInstance setUserInteractionEnabled:YES];
[self addSubview:imageInstance];
对不起,我不知道你的线索,对不起,我不知道你的线索。