當我按下一個按鈕時,我想運行一系列方法methodOne然後methodTwo然後methodThree。當我現在運行它時,我只能得到最後一個運行的方法。我希望他們按順序奔跑。我究竟做錯了什麼。運行一系列方法
@implementation JackAnimationViewController
@synthesize color;
- (IBAction)button:(id)sender {
[self methodOne];
[self methodTwo];
[self methodThree];
}
-(void) methodOne{
color.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"greenDim.png"],
[UIImage imageNamed:@"GreenPressed.png"],
[UIImage imageNamed:@"greenDim.png"],
[UIImage imageNamed:@"GreenPressed.png"],nil];
[color setAnimationRepeatCount:2];
color.animationDuration = 1;
[color startAnimating];}
-(void) methodTwo{
color.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"yellowDim.png"],
[UIImage imageNamed:@"YellowPressed.png"],
[UIImage imageNamed:@"yellowDim.png"],
[UIImage imageNamed:@"YellowPressed.png"],nil];
[color setAnimationRepeatCount:2];
color.animationDuration = 1;
[color startAnimating];}
-(void) methodThree{
color.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"yellowDim.png"],
[UIImage imageNamed:@"GreenPressed.png"],
[UIImage imageNamed:@"yellowDim.png"],
[UIImage imageNamed:@"GreenPressed.png"],nil];
[color setAnimationRepeatCount:2];
color.animationDuration = 1;
[color startAnimating];}
@end
什麼類的類是'color'?你能發佈.h文件嗎? – rosslebeau 2012-03-28 00:05:48
基於方法名稱的@passedpawn'color'看起來像一個'UIImageView'。 – Jonah 2012-03-28 01:05:07