2009-11-10 6 views
3

Je suis un noob en objectif-c et en cacao, et je voudrais mettre en œuvre une animation simple de UIImageView avec animation retournée. Mais j'ai du mal à le faire. Voici mes extraits:animer UIImageView avec animation flip

UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,33,33)]; 
UIImageView *img1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:IMG1]]; 
UIImageView *img2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:IMG2]];        
[containerView addSubview:img1]; 
[containerView addSubview:img2]; 
[self.view addSubview:containerView]; 

CGContextRef context = UIGraphicsGetCurrentContext(); 
[UIView beginAnimations:nil context:context]; 
[UIView setAnimationDuration:0.75]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:containerView cache:YES]; 
[containerView exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; 
[UIView commitAnimations]; 

Merci.

+0

salut! Toute solution ici? – Frade

Répondre

1

Vous faites référence à un objet appelé view qui n'est jamais déclaré. Je pense que vous devez changer l'avant-dernière ligne à

[containerView exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; 

Voir si cela aide.

+0

oups, désolé c'est un mistypo. merci – domlao

+0

note mon commentaire ci-dessus ne signifie pas que mon problème a été résolu. – domlao