有没有办法知道“点击”是在 UIView 的 mask 区域之内还是之外?我正在使用 CoreGraphics 来屏蔽 UIView。
到目前为止,我的代码是这样的......
- (void)viewDidLoad {
UIGestureRecogniser *r = [[UIGestureRecogniser alloc] initWithTarget:self action:@selector(gestCall:)];
[self addGestureRecogniser:r];
}
- (void)gestCall:(UIGestureRecogniser *)gestRec {
if ("somthing") {
// outside of mask
} else {
// inside of mask
}
}
谢谢。
最佳答案
我终于找到了我一直在寻找的解决方案。因此,为了任何试图找到 CGPoint 的人的利益,CGPoint 位于任何 CGPath 中。
很简单。
UIBezierPath *p = [UIBezierPath bezierPathWithCGPath:anyCGPath];
BOOL isInPath = [p containsPoint:anyCGPoint];
关于iphone - 屏蔽的 UIView 上的 UIGestureRecogniser?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12977928/