簡體   English   中英

如何將CABasicAnimation轉換為UIView animatewithDuration

[英]How to convert a CABasicAnimation to UIView animatewithDuration

我想將CABasicAnimation轉換為UIView animatewithDuration,是否有可能做到這一點?

到目前為止,這是我嘗試過的代碼

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"];

[UIView animateWithDuration... (而不是CABasicAnimation ,我希望它在animationWithDurationanimations塊。)

這可能嗎? 如果是這樣,怎么辦?

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

                 }];

提前致謝

  [UIView animateWithDuration:0.5
                          delay:1.0
                        options: UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         //self.myView.transform = CGAffineTransformMakeScale(2.0,1.0);
                     self.testview.layer.transform = CATransform3DMakeScale(2.0,1.0,1.0);

                     }
                     completion:^(BOOL finished){

                     }];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM