2010-10-29 67 views
1

我有2的UIImageViews foo1,foo2的未互相交叉,并且我有3个功能touchesBegantouchesMovedtouchesEndedtouchesMoved的UIView检测

- (void) touchesMoved:(NSSet *) touches withEvent:(UIEvent *) event 
{ 
    UITouch *touch = [touches anyObject]; 

     if (foo1 == [touch view]){ 
     NSLog(@"foo1"); 
     }  

     if (foo2 == [touch view]){ 
     NSLog(@"foo2"); 
     }  
} 

我持有触摸上foo1和移动我手指foo2的,但从nslog我得到foo1消息。

有没有可能在touchesMoved函数中确定触摸foo 2时的功能?

谢谢

回答

0

默认情况下它不以这种方式工作。一旦一个视图“捕获”了一次触摸(换句话说,一旦它被触击测试到视图内),触摸将“追踪”到该视图直到它被释放,即使触摸的位置超出界限的看法。

(我的猜测是,它可以可能覆盖与-pointInside:withEvent:和/或-hitTest:withEvent:方法的微妙压倒一切的这种行为,但我不能告诉你怎么离开我的头顶,我实际上不确定这是可能的。)