iPhone SDK Touches Moved?
I'm trying to figure out how to make it so that when I'm moving an object around, I'm not "holding" it in the 开发者_StackOverflow社区center of the object, but rather towards the left or right. This is my code so far...
-
(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *myTouch = [[event allTouches] anyObject];
image1.center = [myTouch locationInView:self.view];
image1.image = [UIImage imageNamed:@"image1.png"];
}
I would imagine it's because of image1.center, but how do i make it so that it gets touched somewhere else, not the center?
I figured it out. I'm just going to take image1 out of the frame directly after putting it in the frame, but make it appear as if it's still there. Now it only plays the sound once.
精彩评论