【发布时间】:2015-04-28 18:25:18
【问题描述】:
我有一个带有子视图的视图。当子视图中的一个按钮被点击时,子视图会扩展到视图的边界之外,并呈现几个其他按钮。但是,我找不到与他们互动的方法。
我在 Apple 的网站上找到了一个代码:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
// Convert the point to the target view's coordinate system.
// The target view isn't necessarily the immediate subview
CGPoint pointForTargetView = [self.targetView convertPoint:point fromView:self];
if (CGRectContainsPoint(self.targetView.bounds, pointForTargetView)) {
// The target view may have its view hierarchy,
// so call its hitTest method to return the right hit-test view
return [self.targetView hitTest:pointForTargetView withEvent:event];
}
return [super hitTest:point withEvent:event];
}
但是,我不明白我应该如何使用它,以便我的子视图能够识别触摸。
任何帮助将不胜感激。
【问题讨论】:
标签: ios uiview uigesturerecognizer