IOS: verify if a point is inside a rect

前端 未结 8 1433
夕颜
夕颜 2021-01-30 04:55

Is there a way to verify if a CGPoint is inside a specific CGRect.

An example would be: I\'m dragging a UIImageView and I want t

8条回答
  •  悲哀的现实
    2021-01-30 05:31

    In swift you can do it like this:

    let isPointInFrame = frame.contains(point)
    

    "frame" is a CGRect and "point" is a CGPoint

提交回复
热议问题