if (CGRectContainsPoint(dresser.frame,[touch locationInView:self.view])) {
bow.image = nil;
}
I have this code in my touchesEnded event. The CGRectContainsPoint takes two arguments. The first is a rectangle and the second is a CGPoint. If the CGPoint is in the rectangle then it returns true. When the statement returns true, I make the image invisible by setting it to nil. Instead of using the location of my finger, I could use bow.center which is also a CGPoint describing the middle of the bow image.
0 comments:
Post a Comment