Flipkart Search

Search This Blog

Thursday, November 26, 2009

Funny UIPickerView Animation

//Take a NSTimer object and a integer variable in your header file like this

   NSTimer *timer;
   int ComponentNumber;

//Put this line into your viewDidLoad

    ComponentNumber=0;
    timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(ChangeComponentNumber) userInfo:nil repeats:YES];


-(void)ChangeComponentNumber
{
    if(ComponentNumber>8)
    {
        [timer invalidate];
        return;
    }
    else if(ComponentNumber==4)
    {
        ComponentNumber=ComponentNumber+1;
        [self performSelector:@selector(HidePickerComponents) withObject:nil afterDelay:0.0];
    }
    else
    {       
        [self performSelector:@selector(HidePickerComponents) withObject:nil afterDelay:0.0];
    }
}
-(void)HidePickerComponents
{   
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];   
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:AlarmSoundPicker cache:YES];
    [(UIView*)[[AlarmSoundPicker subviews] objectAtIndex:ComponentNumber] setHidden:YES];   
    [UIView commitAnimations];   
    ComponentNumber=ComponentNumber+1;
   
}

1 comment:

mohammed rafiq said...

Hi,
Do u have any sample on uipickerview which inserts values from sqlite database to uipickerview.
A m searching this from a week

Thank u