ios - 确定哪个 CGPath 被窃听

标签 ios objective-c uiview core-graphics

我正在寻找我所说的 CGPathContainsPoint 的逆。我在 UIView 中有一系列可点击区域,如果用户点击,我需要找出用户点击的区域。

除了使用 CGPathContainsPoint 检查每个区域之外,是否有更好的方法来简单地确定哪个 CGPath 被点击了?

谢谢!

最佳答案

if (CGPathContainsPoint(path, NULL, touchpositionInView, NO)){
BOOL PathContainsPoint = YES;
}

if (CGPathContainsPoint(path2, NULL, touchpositionInView, NO)){
BOOL Path2ContainsPoint = YES;
}
//...

我不明白这段代码有什么问题?

关于ios - 确定哪个 CGPath 被窃听,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22183964/

相关文章:

iOS 使用 CAShapeLayer 绘制自定义形状

ios - OpenCV findContours 崩溃

iphone - xcode 自定义 ttf 字体不工作

ios - 获取使用 drawInRect 绘制的 NSString 中 x、y 位置的字符索引

ios - 如何在 SWIFT 3 中将 HTTPS 代理添加到 NSURLSession

objective-c - 检测特定 View 是否是 WebView

objective-c - 当用户默认值更改时如何收到通知?

ios - 什么使元素可访问?为什么点击手势比 UIButton 更难访问?我如何解决它?

ios - 如何检测 iPhone 5c 的颜色?

ios - 在代码中自定义 UIView