我想降低pickerview的动画速度以模拟老虎机效果。
如何降低
的动画速度[pickerView selectRow:601 inComponent:0 animated:YES];
此外,我如何错开动画,以便组件1在组件0动画之后动画等等。就像老虎机一样。
我尝试了以下代码来错开旋转,它们似乎都在同时旋转。
- (void) viewDidAppear:(BOOL)animated
{
[UIView beginAnimations:@"reel1" context:nil]; // nil = dummy
[UIPickerView setAnimationDelegate:self];
[UIPickerView setAnimationDidStopSelector:@selector(reelAnimationFinished:finished:context:)];
[reel selectRow:24 inComponent:0 animated:YES];
[UIView commitAnimations];
}
- (void) reelAnimationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context {
if (animationID == @"reel1")
{
[UIView beginAnimations:@"reel2" context:nil]; // nil = dummy
[UIPickerView setAnimationDelegate:self];
[UIPickerView setAnimationDidStopSelector:@selector(reelAnimationFinished:finished:context:)];
[reel selectRow:26 inComponent:1 animated:YES];
[UIView commitAnimations];
}
else if (animationID == @"reel2")
{
[reel selectRow:29 inComponent:2 animated:YES];
}
}