2014-06-24 1 views
-3

에 탭하면 검색 및 내가보기에 탭 때 알고 싶은 나는 특정보기 여부를 확인하기 위해 그것을뷰가 나는의 ViewController 내부에 여러 뷰가

+1

내가 생각 여기에 빠른 사용자 정의 구현입니다 이것은 iOS이지만 "클릭"이라는 용어는 마우스 사용을 의미합니다. 태그를 수정하십시오. – trojanfoe

+0

iOS에서 일이 탭됩니다. 클릭 할 것이 없습니다. – Fogmeister

+0

가능한 중복 [다른 UIView 중 특정 UIView를 만졌을 때 감지] (http://stackoverflow.com/questions/2793242/detect-if-certain-uiview-was-touched-amongst-other-uiviews) – Hemang

답변

0

대해 이동하는 방법을 잘 모르겠어요 다른 뷰를 터치하면 hitTest를 사용할 수 있습니다. touchesBegan의 사용자 정의 구현에서

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; 

설정 터치의 모든 터치를 확인합니다. 그러나 hitTest 방법의 포인트는

- (CGPoint)locationInView:(UIView *)view; 
method, where the view is your superView (the one that contains other views). 

편집을 사용하여 얻을 수 있습니다 :이 도움이되었다 희망

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    CGPoint locationPoint = [[touches anyObject] locationInView:self]; 
    UIView* viewYouWishToObtain = [self hitTest:locationPoint withEvent:event]; 
} 

, 폴

출처 : Detect if certain UIView was touched amongst other UIViews

관련 문제