Je suis nouveau à l'animation de base je veux faire tourner un imageview gauche ou à droite, mais je veux le faire tourner dans l'axe z il peut donc ressemble à une rotation.Here circulaire est une image pour plus d'explicationsComment faire pour faire pivoter UIImageView en mode circulaire 3D?
alt text http://i45.tinypic.com/e9avx2.png
Je veux faire pivoter l'image de l'image intérieure, ce sont deux vues d'image.
J'ai essayé ce code s'il vous plaît quelqu'un appliquez ceci et corrigez le code.
-(void)Rotate
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:3.0];
CATransform3D t1 = CATransform3DIdentity;
if(goingCW)
{
t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
t1 = CATransform3DTranslate(t1, CUBESIZE/2, 0, 0);
t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
t1 = CATransform3DTranslate(t1, CUBESIZE/2, 0, 0);
t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
t1 = CATransform3DTranslate(t1, CUBESIZE/2, 0, 0);
CATransform3D moveTransform = CATransform3DRotate(t1, 0.0, -1.0, 0.0, 0.0);
[InnerView.layer setTransform:moveTransform];
NSLog(@"Going Left");
}
else
{
NSLog(@"Going Right");
t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
t1 = CATransform3DTranslate(t1, CUBESIZE, 0, 0);
CATransform3D moveTransform = CATransform3DRotate(t1, 0.0, 1.0, 0.0, 0.0);
[InnerView.layer setTransform:moveTransform];
}
goingCW=!goingCW;
[UIView commitAnimations];
}
appellent cela avec une minuterie viewDidLoad ou applicationDidFinishLaunching
goingCW = YES; // change this to NO to make it start rotating CCW instead A bool flag in header file.
NSTimer *timer=[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(Rotate) userInfo:nil repeats:YES];
Je crois que le curseur de votre photo n'utilise pas de substance 3D, mais une vue de défilement 2D avec une image transparente sur le dessus. – kennytm