ios - How do I animate my subviews on adding them? -
i have developed font selection utilizes uipickerview , uitoolbar, both added on touching uibutton.
but kind of pop in looks sloppy.
is there way animate them?
here method adds them (it's called on clicking button) :
-(void)showpicker { [self.view addsubview:_fontpicker]; [self.view addsubview:pickertb]; }
you can animate them in couple of ways, easiest fade them in.
fade in
[someview setalpha:0] [self.view addsubview:someview]; [uiview beginanimations:@"fadein" context:nil]; [uiview setanimationduration:0.5]; [uiview setanimationbeginsfromcurrentstate:yes]; [someview setalpha:1]; [uiview commitanimations];
fade out
float fadeduration = 0.5; [uiview beginanimations:@"fadeout" context:nil]; [uiview setanimationduration:fadeduration ]; [uiview setanimationbeginsfromcurrentstate:yes]; [someview setalpha:0]; [uiview setanimationdidstopselector:@selector(removeview)]; [uiview commitanimations]; -(void) removeview { [someview removefromsuperview]; }
something simple that.
Comments
Post a Comment