增加手势点击的某点是否在某个对象上面

- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {

UITouch*touch = [touchesanyObject];

CGPoint touchLocation = [touchlocationInView:self.view];

CGRect bugRect = [bugframe];

// CGRect bugRect = [[[bug layer] presentationLayer] frame];

if(CGRectContainsPoint(bugRect, touchLocation)) {

NSLog(@"tapped!");

}else{

NSLog(@"not tapped.");

return;

}

你可能感兴趣的:(增加手势点击的某点是否在某个对象上面)