How can I check if a user tapped near a CGPath?

后端 未结 3 1736
终归单人心
终归单人心 2020-12-05 08:35

Scenario:

I have a set of CGPaths. They are mostly just lines (i.e. not closed shapes). They are drawn on the screen in a UIView\'s draw

3条回答
  •  盖世英雄少女心
    2020-12-05 09:37

    In Swift

    let area = stroke.copy(strokingWithWidth: 15, lineCap: .round, lineJoin: .round, miterLimit: 1)
    if (area.contains(point)) { ... }
    

提交回复
热议问题