2010-10-11 6 views
1

Je veux faire une animation comme exemple SwichView dans "Le développement de l'iPhone au début". Mon code d'animation:Appliquer une animation dans UIView spécifié?

[UIView beginAnimations:@"View Flip" context:nil]; 
    [UIView setAnimationDuration:1.25]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 

    [UIView setAnimationTransition: 
    UIViewAnimationTransitionFlipFromRight 
          forView:self.view cache:YES]; 

    [blueViewController viewWillAppear:YES]; 
    [yellowViewController viewWillDisappear:YES]; 
    [blueViewController.view removeFromSuperview]; 
    [self.view insertSubview:yellowViewController.view atIndex:0]; 
    [yellowViewController viewDidDisappear:YES]; 
    [blueViewController viewDidAppear:YES]; 

    [UIView commitAnimations]; 

alt text

Mais je veux que ma barre d'outils ne sont pas "flip" avec une autre vue. Je ne veux pas qu'il fasse une animation. Puis-je le faire?

Voici par exemple SwitchView:

http://www.mediafire.com/?lirh0ydcy6c2f9d

Répondre

0

Voir TransitionViewController.m dans le code exemple UICatalog d'Apple.

+0

Merci pour votre aide :) –

+0

Pas de problème, mais si cela répond à votre question, vous devriez le voter et cliquez sur la coche pour accepter la réponse. – Nimrod

1

Essayez avec votre Gor vue d'obtenir pop up animation

- (void)doPopInAnimationWithDelegate 
{ 
CALayer *viewLayer = appDelegate.objSplitView.view.layer; 
CAKeyframeAnimation* popInAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; 
popInAnimation.duration = 0.5; 
popInAnimation.values = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.6], [NSNumber numberWithFloat:1.1], [NSNumber numberWithFloat:.9], [NSNumber numberWithFloat:1], nil]; 
popInAnimation.keyTimes = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.4], [NSNumber numberWithFloat:0.8], [NSNumber numberWithFloat:1.0], nil]; 
[viewLayer addAnimation:popInAnimation forKey:@"transform.scale"]; 
} 
Questions connexes