【发布时间】:2010-12-12 22:11:54
【问题描述】:
类似于以前的西蒙游戏,我想向用户展示一个按钮序列,然后让他们重复它。我卡住的地方是显示第一个按钮突出显示 500 毫秒,等待 100 毫秒,显示第二个按钮突出显示 500 毫秒,再等待 100 毫秒,显示第三个等等。
我从其他 Stackoverflower'ers 得到了这个块:
redButton.highlighted = YES;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationStartDate:[NSDate dateWithTimeIntervalSinceNow:1]];
[UIView setAnimationsEnabled:NO];
redButton.highlighted = NO;
[UIView commitAnimations];
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationStartDate: [NSDate dateWithTimeIntervalSinceNow:2]];
[UIView setAnimationsEnabled:NO];
blueButton.highlighted = YES;
[UIView commitAnimations];
redButton 将突出显示,但不会发生任何后续操作。
【问题讨论】:
标签: iphone cocoa-touch uikit core-animation