mardi 5 mai 2015

Is it possible to convert a CABasicAnimation to [UIView animatewithDuration...?

I want to get the following code

CABasicAnimation *myAni = [CABasicAnimation animationWithKeyPath:@"transform.scale.x"];
myAni.duration = 2.0f;
myAni.fromValue = [NSNumber numberWithFloat:1.0];
myAni.toValue = [NSNumber numberWithFloat:2.0];

[self.myView addAnimation:scaleAnimation forKey:@"myKey"];

to be in [UIView animateWithDuration.... (Instead of CABasicAnimation, I want it in animationWithDuration in the animations block.)

Is this possible? If so, how?

[UIView animateWithDuration:0.5
                      delay:1.0
                    options: UIViewAnimationCurveEaseOut
                 animations:^{
                     //I need it here
                 } 
                 completion:^(BOOL finished){

                 }];

Aucun commentaire:

Enregistrer un commentaire