Oui, il est possible d'avoir une animation lorsque vous appelez votre préparateur pour définir visible.
Votre sélecteur est initialement masqué. Lorsque vous appuyez sur UIButton, vous n'appelez que la méthode ci-dessous (animatePicker). Dans la méthode ci-dessous, il est juste caché défini sur false pour pickerview mais avec CAanimation.
-(void)animatePicker
{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
// Set the type and if appropriate direction of the transition,
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromTop];
// Set the duration and timing function of the transtion -- duration is passed in as a parameter, use ease in/ease out as the timing function
[animation setDuration:0.4];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
[[PickerView layer] addAnimation:animation forKey:@"transitionViewAnimation"];
PickerView.hidden = FALSE;
[[PickerView layer] removeAnimationForKey:@"transitionViewAnimation"];
animation = nil;
}
Note: S'il vous plaît inclure cadre Quartz (QuartzCore.framework) et importer son fichier d'en-tête (QuartzCore/QuartzCore.h) à votre contrôleur.
Merci mon cher frnd –