0

我有多个UIImageViews放置在以编程方式添加的 NxN 网格视图上UIView,并且都将其userInteractionEnabled属性设置为YES

已编辑

我现在有另一个问题,如果我开始拖动 UIImageView 并将鼠标悬停在其他 UIImageViews 上,那么只有第一个调用 touchesMoved 方法。例如,在 touchesMoved 方法中带有 [[touches anyObject] view.tag] 的示例 NSLog 将打印:

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,我基本上想突出显示选定的单元格。

4

1 回答 1

0

尝试这个:

if ([touch view] == img1) { 
   // move the image view
   img1.center = touchLocation;        
}
else if ([touch view] == img2) {
    // move the image view
   img2.center = touchLocation;        
}
于 2012-10-21T21:42:03.027 回答