iphone - Forward a UIGestureRecognizer from one view controller to another view controller -
i'm adding uigesturerecognizer 1 of view controllers view.
my desired behaviour when gesture recognised dismiss gestures view controller , forward view controller. (the view controller want forward has presented view controller gesture)
right when dismiss view controller, pinch gesture recogniser (logically) failing.
any suggestions? thanks.
\edit: delegate argument gesturerecognizer.
you can implement protocol like:
@protocol viewcontrollerwithgesturerecognizerdelegate - (void)viewcontrollergesturerecognizerevent:(uipinchgesturerecognizer *)gesturerecognizer; @end and add delegate property view controller in there presented gesture recognizer.
@property (nonatomic, weak) id<viewcontrollerwithgesturerecognizerdelegate> delegate; then add gesture recognizer view controller:
uipinchgesturerecognizer *gesturerecognizer = [[uipinchgesturerecognizer alloc] initwithtarget:self action:@selector(gesturerecognizeraction:)]; [self addgesturerecognizer:gesturerecognizer]; call delegate method in action method of gesture recognizer:
- (void)gesturerecognizeraction:(uipichgesturerecognizer *)gesturerecognizer { [self.delegate viewcontrollergesturerecognizerevent:gesturerecognizer]; } implement protocol viewcontrollerwithgesturerecognizerdelegate in second view controller (in want notified gesture recognizer events) , set delegate of view controller gesture recognizer second view controller.
viewcontrollerwithgesturerecognizer.delegate = viewcontrollerinwhichyouwanttogetnotifiedaboutgesturerecognizerevents. this way every time gesture recognizer call method on the 1 view controller, second 1 informed that.
Comments
Post a Comment