나는 이것에 초보자이며 응용 프로그램을 리메이크하고 있습니다. UITapGestureRecognizer를 사용하려고합니다. 초기 프로젝트 파일에서는 작동하지만 새 프로젝트 파일에서는 작동하지 않습니다. 유일한 차이점은 이전 컨트롤러는 탐색 컨트롤러를 사용하지만 내 컨트롤러는 사용하지 않는다는 것입니다.모든 가치가 동일한 UITapGestureRecognizer
새로운 거리에서 : 자기 중심 거리 : 중심 위치는 화면을 어디에서 눌러도 640에 고정되어 있습니다.
아무도 도와 줄 수 있습니까? 왜 작동하지 않는지 나는 모른다.
- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer {
CGPoint location = [recognizer locationInView:[recognizer.view superview]];
CGPoint centre = CGPointMake(512,768/2);
NSInteger msg = [self distance:location to:centre];
NSLog(@"location to centre: %d", msg);
if ([self distance:location to:centre] < 330)
'[recognizer.view superview]는 의심 스럽습니다. 어떤 견해입니까? 'recognizer.view'로 바꾸십시오. –
고쳐주세요! 정말 고맙습니다! superview는 다른 버전의 탐색 컨트롤러와 관련이 있습니까? – AnotherNewbie