멀티 터치를 사용하여 iphonecreen에서 이동할 수있는 몇 가지 uiimages가 있습니다. 내가 선택한 영역과 화면으로 움직일 수있는 "팀"내부로 이동하는 uimimages의 "팀"인 두 개의 "팀"으로 팀을 분리하고 싶습니다.멀티 터치에 관한 질문
내 질문은 두 uiimage "팀"과 둘 다 "팀"의 cgpoints가 서로 교차하지 않고 잘못된 uimimages를 잘못된 위치에 제공하지 않고 터치 메소드 (touchesbegan, touchesended, touchesmoved)를 사용하는 방법입니다. 화면. 제 1의 "팀"은 두 가지 방식, 두 가지 방식, 감동적 인 방법을 사용합니다. 두 번째 "팀"은 터치 방식을 사용합니다.
내 코드는 여기에 있습니다. 나는 2 "팀"이 touchesended 방법을 이해하면
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
//1st team
for(UITouch *touch in touches){
// Send to the dispatch method, which will make sure the appropriate subview is acted upon
[self getRubyAtPoint:[touch locationInView:self.view]forEvent: nil];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"touchesEnded");
//1st team
// Enumerates through all touch object
for (UITouch *touch in touches) {
// Sends to the dispatch method, which will make sure the appropriate subview is acted upon
[self dispatchTouchEndEvent:[touch view] toPosition:[touch locationInView:self.view]];
}
//2nd team
UITouch *touch = [touches anyObject];
CGPoint currentTouch = [touch locationInView:self.view];
[self getPieceAtPoint:currentTouch];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
//1st team
NSLog(@"touchesMoved");
// Enumerates through all touch objects
for (UITouch *touch in touches) {
// Send to the dispatch method, which will make sure the appropriate subview is acted upon
[self dispatchTouchEvent:[touch view] toPosition:[touch locationInView:self.view]];
}
}
정확히 ... 내가 1 팀에서만 행동에 dispatchTouchEndEvent과 touchesended 방법 2 팀에서만 행동에 getPieceAtPoint를 원하는 : 같은
뭔가. 꼬리표? 좋아 .. 그거 좋은 생각 같아. 나는 그것을 밖으로 시도하고 알려 드리겠습니다. 고맙습니다 :) – iphonedevonthemake
잘 작동했습니다! 고맙습니다 : D – iphonedevonthemake