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
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
CGRect rect1 = CGRectMake(vwTable.frame.origin.x,
vwTable.frame.origin.y, vwTable.frame.size.width,
vwTable.frame.size.height);
if (CGRectContainsPoint(rect1,touchLocation))
NSLog(@"Inside");
else
NSLog(@"Outside");
}