我想赢得我的框架移动40 / 3px然后停止移动! 如何停止移动并将第x帧更改为40 + 320!谢谢
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if(self.frame.origin.x > 40/3) {
CGRect myFrame = self.frame;
myFrame.origin.x = 40 + self.frame.size.width;
self.frame = myFrame;
}
}
答案 0 :(得分:-1)
更改您的代码:
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if(self.frame.origin.x > 40/3) {
CGRect myFrame = self.frame;
myFrame.origin.x = 40 + self.frame.size.width;
self.frame = myFrame;
[self touchesEnded:touches withEvent:event];
}
}
希望有所帮助