开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜