开发者

How to spin the component picker very fastly in Iphone sdk?

开发者 https://www.devze.com 2023-01-09 03:58 出处:网络
I need a help from ur side.As I ama making the spin action for the component picker it was spinning when I tapped the spin button but it was slow,I need to make the spin fast for 5 seconds and slowly

I need a help from ur side.As I ama making the spin action for the component picker it was spinning when I tapped the spin button but it was slow,I need to make the spin fast for 5 seconds and slowly it rests to it position.can anyone help to get this one.

My code for spin action is:

-(void)SpinAction
{
BOOL win = NO;
int numInRow = 1;
int lastValue = -1;
for(int i = 0;i < 5;i++)
{
    int newValue = random() % [self.column1 count];
    if(newValue == lastValue)
        numInRow++;
    else
        numInRow = 1;
    lastValue = newValue;
    [picker selectRow:newValue inComponent:i animated:YES];
    [picker reloadComponent:i];
    if(numInRow >=开发者_运维百科 3)
    {
        win = YES;
    }

}
if(win == YES)
{
    winLabel.text = @"!!!You Won!!!";
}
else
{
    winLabel.text = @"";
}
}

Thanks in Advance, Monish.


Have a look at the source code from plant-o-matic sample from wwdc 2010 core animation session. http://developer.apple.com/wwdc/sessions/#track-framework

0

精彩评论

暂无评论...
验证码 换一张
取 消