如何在按住 uibutton 的同时移动 uiimageview?旧代码就像您必须按 2 或 3 次才能再次移动,而长按不起作用,因为它在内部进行了修饰。
-(IBAction) MoveRightButton : (id) sender {
[self animateRight];
[self rightTimer];
}
-(IBAction) stopRight {
[image stopAnimating];
[rightTimer invalidate];
}
-(void) animateRight {
with animateRight images and start animating.
}
-(void) goRight {
[UIView animateWithDuration : 0.5 animation : ^{
image.frame = CGRectMake (image.frame.origin.x + 10, image.frame.origin.y,image.frame.size.width, image.frame.size.height);
}];
[self stopRight];
}
-(void) rightTimer {
rightTimer = [some NSTimer with selector of (goright)];