【发布时间】:2014-01-02 18:50:16
【问题描述】:
我有一个包含多个子视图的视图,这些子视图是带有多个按钮的复杂控件。 superview 具有用于点击、滑动等的手势识别器。
在某些情况下,当接收到单点或双点触摸时,我希望超级视图将手势识别器传递给子视图进行处理。
例如:
singletaprecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onSingleTapGestureRecognizerDetected:)];
- (void)onSingleTapGestureRecognizerDetected:(UITapGestureRecognizer*)theTapGestureRecognizer
{
if (someCaseHappens) {
// do something with the gesture - for instance - move a control from one place to another or some other UI action in the superview
}
else {
// the subview will need to get the gesture and do something with it (imagine the touch was inside a button in a subview - the top superview should disregard the gesture and the button should be pressed) - THIS ISN"T HAPPENING NOW
}
}
【问题讨论】:
-
也许你可以用
[singletaprecognizer setCancelsTouchesInView:NO];做点什么
标签: ios objective-c uigesturerecognizer uitouch