0
我做這個代碼啓動動畫當我點擊一個按鈕,當我點擊按鈕應該改變按鈕顯示的是什麼,並啓動動畫,但它只是改變了按鈕說什麼?我的代碼有什麼問題嗎?我的動畫將無法啓動
@synthesize SwishImage;
@synthesize SwishButton;
- (IBAction) Swish {
if (SwishImage.isAnimating) {
[SwishImage stopAnimating];
[SwishButton setTitle:@"Swish" forState:UIControlStateNormal];
} else {
[SwishImage startAnimating];
[SwishButton setTitle:@"Searching" forState:UIControlStateNormal];
}
}
- (void)viewdidload
{
NSArray * SwishArray;
SwishArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"Orange_dot.png"],
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
nil];
SwishImage.animationImages=SwishArray;
SwishImage.animationDuration = 1;
SwishImage.animationRepeatCount = 0;
[super viewDidLoad];
}
非常感謝您的建議,我對編碼感興趣,並且突飛猛進。我已經開始整理我的命名約定。有時很難通過使用現在已經過時的方法來學習教程! – AMAN