IOS: verify if a point is inside a rect
问题 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 to verify if its central point CGPoint is inside another UIImageView 回答1: Swift 4 let view = ... let point = ... view.bounds.contains(point) Objective-C Use CGRectContainsPoint(): bool CGRectContainsPoint(CGRect rect, CGPoint point); Parameters rect The rectangle to examine. point The point to examine. Return Value true if the rectangle is not null or empty and the