키 아이디어 :UITapGestureRecognizer
을 UIImageView
에 추가 할 수 있습니다. 각 탭에 대해 실행되는 selector
설정. selector
에서 탭이 완료된 좌표를 확인할 수 있습니다. 좌표를 행사할 수있는 조건을 만족하는 좌표가 있다면 작업을 실행할 수 있습니다.
제스처 인식기를 추가 :
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleImgViewTap:)];
[singleTap setNumberOfTapsRequired:1];
[yourImgView addGestureRecognizer:singleTap];
선택기 설정 :
-(void)handleImgViewTap:(UITapGestureRecognizer *)gestureRecognizer
{
// this method gonna fire everytime you tap on the
// image view. you have to check does the point where
// the tap was done, satisfy your path/area condition.
CGPoint point = [gestureRecognizer locationInView:yourImgView];
// here point.x and point.y is the location of the tap
// inside your image view.
if(/*your condition goes here*/)
{
// execute your staff here.
}
}
는 희망이 도움이, 해피 IOS 코딩.
지금까지 어떤 시도를 했습니까? – RaffAl
아직 로직을 코딩하지 않았습니다. 이미 존재하는 것이 있는지 검색하기. 장소 경계에 베 지어 경로를 사용하려고합니다. 곧 몇 가지 코드를 작성합니다. – jegadeesh