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
In Swift that would look like this:
let point = CGPointMake(20,20)
let someFrame = CGRectMake(10,10,100,100)
let isPointInFrame = CGRectContainsPoint(someFrame, point)
Swift 3 version:
let point = CGPointMake(20,20)
let someFrame = CGRectMake(10,10,100,100)
let isPointInFrame = someFrame.contains(point)
Link to documentation . Please remember to check containment if both are in the same coordinate system if not then conversions are required (some example)