我将多个userInteractionEnabled放置在以编程方式添加的UIView上生成NxN网格视图,并且它们的NxN属性都设置为YES。
编辑的
现在我有了另一个问题,如果我开始在UIImageView上拖动并在其他UIImageViews上悬停,那么第一个问题就是调用touchesMoved方法。例如,在NSLog方法中带有[touches view.tag]的示例touchesMoved将打印:
Log: touchesBegan for object with tag=123
Log: touchesMoved for object with tag=123
Log: touchesMoved for object with tag=123
...
Log: touchesEnded for object with tag=123有办法这样做吗?如果用户动态地拖动UIImageViews,我基本上希望突出显示选定的单元格。
发布于 2012-10-21 21:42:03
试试这个:
if ([touch view] == img1) {
// move the image view
img1.center = touchLocation;
}
else if ([touch view] == img2) {
// move the image view
img2.center = touchLocation;
}https://stackoverflow.com/questions/12988601
复制相似问题