How to make UIView animation sequence repeat and autoreverse

后端 未结 3 1779
走了就别回头了
走了就别回头了 2020-12-02 08:29

How to make this complex animation repeat and autoreverse? Is there any way to add options UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat to this animation s

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 09:12

        UIImageView *pin = [UIImageView new];
        [pin setFrame:CGRectMake(115, 160, 30, 60)];
        [pin setBackgroundColor:[UIColor redColor]];
        [holderView addSubview:pin];
    
        [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat
                         animations:^{
                            // [pin setTransform:CGAffineTransformMakeTranslation(0, 20)];
                             [pin setFrame:CGRectMake(115, 200, 60, 100)];
                         }completion:^(BOOL finished){
    
                         }];
    

提交回复
热议问题