ios - Constricting UISwipeGestureRecognizer to only detect swipes within the area of a IUImageView -


i using following code detect swipe gestures in app:

- (ibaction)swipermethod:(uiswipegesturerecognizer *)sender {     _sampletext.text=@"hi"; }  - (void)viewdidload {     [super viewdidload];     uiswipegesturerecognizer *leftrecognizer = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swipermethod:)];     [leftrecognizer setdirection: uiswipegesturerecognizerdirectionleft];     [[self view] addgesturerecognizer:leftrecognizer];     // additional setup after loading view, typically nib. } 

however, want restrict swipe recognition portion of screen defined uimageview. there simple way this? thanks.

if know uiimageview is, can test whether gesture inside area:

- (bool)pointinside:(cgpoint)point{      return (point.y < imageviewbottom && point.y > imageviewtop && point.x < imageviewright && point.x > imageviewleft); } 

if gesture outside uiimageview ignore it.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -