2013-01-12 152 views
0

雖然使用下面的代碼時,我接觸的對象的對象被搖動,多對象拖動

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
    { 
UITouch *touch = [[event allTouches] anyObject]; 
    if ([touch view] == img1) 
    { 
     CGPoint location = [touch locationInView:touch.view]; 
     img1.center = location; 
     return; 
    } 
    if (touch.view == img2) 
    { 
     CGPoint location = [touch locationInView:touch.view]; 
     img2.center = location; 
     return; 
    } 
    } 
    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 
[self touchesBegan:touches withEvent:event]; 
    } 

這是在我的代碼的問題,是否有任何其他的方法來拖動和dragin多對象如果視圖包含多一個對象?請幫我解決這個問題

回答

0

我覺得如果你是在談論更多的物體一次全部拖然後從你接觸begain方法

+0

的具有1M mutilple對象,你應該刪除的回報,但我一次拖一個,同時刪除塔retun也不工作公關opely, –