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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Swift 4
Objective-C
Use
CGRectContainsPoint():bool CGRectContainsPoint(CGRect rect, CGPoint point);Parameters
rectThe rectangle to examine.pointThe point to examine.Return Value
true if the rectangle is not null or empty and the point is located within the rectangle; otherwise, false.
A point is considered inside the rectangle if its coordinates lie inside the rectangle or on the minimum X or minimum Y edge.