iPhone SDKでオブジェクトをドラッグする際に問題があります。私のUIImageViewコンセントは赤で、ドラッグが機能しない理由はわかりません!しかし、もし行を削除したときに私のコードは、ここでは、正常に動作コードです:あなたはUIViewのサブクラスのtouchesBeganを上書きする場合特定のオブジェクトをドラッグ
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches]anyObject];
if ([touch view] == red) {
CGPoint location = [touch locationInView:self.view];
red.center = location;
}
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}
CGPoint – Momi