在Xcode中,我有两个按钮:、Start、和Stop。
当您单击Start startClick时,当您单击停止时,调用 stopClick。
当您单击Start时,UIImageView映像将显示与NSArray不同的图像。当您单击 stop 时,它会停止,但我希望它在我单击Stop时显示的图像上停止。就在此刻,它停了下来.有什么帮助吗?
下面是代码的一部分:
- (IBAction)startClick:(id)sender {
color.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed: @"img1.png"],
[UIImage imageNamed: @"img2.png"],
[UIImage imageNamed: @"img3.png"],
[UIImage imageNamed: @"img4.png"],nil];
[color setAnimationRepeatCount: 0];
color.animationDuration = 1;
[color startAnimating];
}
- (IBAction)stopClick:(id)sender {
[color stopAnimating];
//What code do i put here to display the last image? (as i clicked stop).
}我还想添加if状态,因为如果显示的颜色是img1.png,那么就这样做.如果它这么做了..。
发布于 2013-04-04 15:18:49
此代码将暂停动画:
color.frame = [[color.layer presentationLayer] frame];
[color.layer removeAllAnimations];https://stackoverflow.com/questions/15815135
复制相似问题