Change UIImageView image half way of a flip animation

前端 未结 3 1896
梦谈多话
梦谈多话 2021-02-10 07:58

How can I change the image of a UIImageView on half way of a Flip animation. My code does seem to flip the UIImageView and successfully change the image but it is changing in an

3条回答
  •  感情败类
    2021-02-10 08:54

    Try a two steps animation, if you don't like this you can lookup the documentation for concatenating options.

    [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveEaseIn
                     animations:^(void) {
                         //do your half rotation here
                         imageView.transform = CGAffineTransformMakeScale(0, 1);
                     }
                     completion:^(BOOL finished) {
                         if(finished){
                             imageView.image = [UIImage imageNamed:@"fb2.jpg"];
                             [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveEaseOut
                                              animations:^(void) {
                                                  //do your second half rotation here
                                                  imageView.transform = CGAffineTransformMakeScale(-1, 1);
                                              } completion:^(BOOL finished) {
    
                                              }];
                         }
                     }];
    

提交回复
热议问题