Thursday, 15 January 2015

iphone - disable gesture recognizer only for particular view -



iphone - disable gesture recognizer only for particular view -

on 1 viewcontroller have 1 mainview, on view have 1 view (which known sidepanel view having frame 0,0,86,420.)i have added tapgesture. want enable gesture recognition mainview other sidepanelview. see below image

i want disable tapgesture sidepanelview & enable area other it. how it. (one thing want area other sidepanelview parentview of sidepanelview).

you should take bharat's reply because correct. want illustrate how it:

define view controller conforming uigesturerecognizerdelegate, e.g.:

@interface viewcontroller () <uigesturerecognizerdelegate> // rest of interface @end

make sure set delegate gesture:

uitapgesturerecognizer *gesture = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handlemaintap:)]; gesture.delegate = self; [self.view addgesturerecognizer:gesture];

then have , check see if touch takes place view in question:

- (bool) gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch { if (cgrectcontainspoint(self.menuview.bounds, [touch locationinview:self.menuview])) homecoming no; homecoming yes; }

iphone ios view uigesturerecognizer

No comments:

Post a Comment