ios - exclude subview from UIPinchGestureRecognizer -
uiview *superview = [[uiview alloc] initwithframe:cgrectmake:(0, 0, 320, 480); uiview *subview = [[uiview alloc] initwithframe:cgrectmake:(0, 0, 320, 480); uipangesturerecognizer *recognizer = [[uipinchgesturerecognizer alloc] initwithtarget: self action: @selector(handlepinch); superview.userinteractionenabled = yes; subview.userinteractionenabled = yes; [superview addgesturerecognizer:recognizer];
i have subview overlapping on top of superview. subview has 4 buttons needs tappable. superview has pinch-zoom gesture zooms view. disable zoom on subview. recognizer fired inside subview well, there way exclude recognizer subview?
i used simple way below:
- (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldreceivetouch:(uitouch *)touch { if (touch.view != subview) { // accept touchs on superview, not accept touchs on subviews return no; } return yes; }
Comments
Post a Comment