在iOS中添加闪烁动画而不使用NSTimer

在iOS中添加闪烁动画而不使用NSTimer,ios,objective-c,iphone,ipad,Ios,Objective C,Iphone,Ipad,我想在我的应用程序中添加闪烁动画。为此,我使用了下面的代码 if (buttonFlashing) return; buttonFlashing = YES; self.img_one.alpha = 1.0f; [UIView animateWithDuration:0.12 delay:0.0 options:UIViewAnim

我想在我的应用程序中添加闪烁动画。为此,我使用了下面的代码

if (buttonFlashing) return;
        buttonFlashing = YES;
        self.img_one.alpha = 1.0f;
        [UIView animateWithDuration:0.12
                              delay:0.0
                            options:UIViewAnimationOptionCurveEaseInOut |
         UIViewAnimationOptionRepeat |
         UIViewAnimationOptionAutoreverse |
         UIViewAnimationOptionAllowUserInteraction
                         animations:^{
                             self.img_one.alpha = 0.0f;
                         }
                         completion:^(BOOL finished){
                             // Do nothing
                         }];
        mode_count=1;
它可以很好地隐藏和显示图像视图,但我想在图像被隐藏时显示另一个图像,然后使用上述代码再次显示上一个图像。上面的代码只是使用alpha隐藏和显示图像视图。我该怎么做?

试试这个代码

[UIView transitionWithView:self.imageView
                  duration:1.2f
                   options:UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAutoreverse |UIViewAnimationOptionRepeat
                animations:^{
                    self.imageView.image=[UIImage imageNamed:@"phone-icon.png"];
                } completion:NULL];

当第一个imageview alpha=1.0f该时间设置第二个imageview alpha=0.0f和第一个imageview alpha=0.0f该时间设置第二个imageview alpha=1.0f时,使用两个imageview