I'd like to slow down the animation speed of the pickerview to simulate a slot machine effect.
How do I slow the animation speed of
[pickerView selectRow:601 inComponent:0 animated:YES];
Also, how can I stagger the animations so that component 1 animates after component 0 animates, etc.. just like a slot machine.
I've tried the following code to stagger the spins and they all seem to spin at the same time.
- (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];
}
}