Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一张按地区划分的国家/地区地图,例如http://www.understandingitaly.com/regions.html将这些区域“转换”为“可触摸”区域的最佳方法是什么,当我点击一个时会响应并通知他们?
如果您将您的国家/地区绘制为贝塞尔路径(例如使用UIBezierPath),您可以使用该containsPoint:方法检查您绘制的特定路径是否包含触摸位置。
UIBezierPath
containsPoint:
这是我在stackoverflow上的第一个答案。
我会尝试做这样的事情:
使用 region (x, y) 尝试为每个区域设置一个“可触摸”区域。
找出每个区域的 (x, y) 中心点是什么。然后,根据给定的中心点定义一个矩形区域。