0

나는 터치가 해제 된 위치에서 (화면에서) 오브젝트를 가져오고 싶습니다. UITouch의 위치에서 UIView 개체를 가져 오는 방법 - (void) touchesEnded : withEvent :?

은 드래그 앤 드롭을 구현하는 데 사용됩니다 나는이 오버라이드 (override)하는 방법이 있습니다 touchesEnded에 [[touches anyObject] view]를 사용

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event; 
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event; 
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event; 

을 : withEvent : 나에게 내가 먼저 감동 곳의 UIView의 객체를 제공하지만 나는 어디에서 만졌어.

[[touches anyObject] locationInView:self.view]을 사용하면 터치가 해제 된 위치가 표시되지만 UIView에 좌표를 매핑해야합니다.

+1

이 도움이 될 수 있음 : [http://stackoverflow.com/questions/16328875/how-to-find-out-what-view-a-touch-event -ended-at] (http://stackoverflow.com/questions/16328875/how-to-find-out-what-view-a-touch-event-ended-at) –

+0

@Ronak Chaniyara AH. 고맙습니다. 나는 그것을 어디에서도 발견 할 수 없었다. 나는 단지 잘못된 단어를 인터넷 검색하고 있었다고 생각한다. – David

+0

위대한 당신은 그것을 고쳤다! @ David –

답변