我已经完成此代码以在单击按钮时启动动画,当我单击按钮时应该更改按钮的内容并启动动画,但它只会更改按钮的内容?我的代码有什么问题吗?
@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];
}