在Xcode我有2個按鈕:開始和停止。UIImageView stopAnimation
當您單擊開始startClick
被調用,當你點擊停止stopClick
被調用。
當您單擊開始 UIImageView圖像將閃爍來自NSArray的不同圖像。當您點擊停止時,它會停止,但我希望它停止在當我點擊停止時顯示的圖像上。目前它只是停止並消失...有什麼幫助?
繼承人的部分代碼:
- (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).
}
我也想補充如果,如果顯示的顏色是img1.png然後statments做到這一點......如果它img2.png做到這一點。 ..
把正確的標題...這是很好的程序員其他:) – iPatel 2013-04-04 15:16:05
@ user125697我沒加C++標籤.... – 2013-04-04 15:17:47
其在的。 m類 – user2245512 2013-04-04 15:17:59