title: How to repeat animation forever in iOS?
body: <p>I want to repeat an animation forever in my view. Below is my code:</p>
  
  <pre><code>[UIView animateWithDuration:0.5f
          delay:0.49f
          options:UIViewAnimationOptionCurveEaseInOut
          animations:^{
          //for IMMERSE
          [_pic2 setAlpha:1.0f];
           _view1_immerse=_pic2.frame;
           _view1_immerse.origin.x = ([UIScreen mainScreen].bounds.size.width-_view1_immerse.size.width)/2;
           self.pic2.frame=_view1_immerse;
           }
           completion:^(BOOL finished){
           [UIView animateWithDuration:0.5f delay:0.49f options:UIViewAnimationOptionCurveEaseOut animations:^{
           _view1_immerse=_pic2.frame;
           _view1_immerse.origin.x = [UIScreen mainScreen].bounds.size.width;
           self.pic2.frame=_view1_immerse;
           [_pic2 setAlpha:0.0];
           } completion:^(BOOL finished){
           [UIView animateWithDuration:0.0f animations:^{
           _view1_immerse=_pic2.frame;
           _view1_immerse.origin.x = -_view1_immerse.size.width;
           self.pic2.frame=_view1_immerse;
                                       }];
                                   }];
                               }];
  </code></pre>
  
  <p>I tried adding option <code>UIViewAnimationOptionRepeat</code>, but it seems that it only repeats the "animation" part of the most outside layer. I want to repeat the whole set of animation.</p>
  
  <p>And I do not want to use <code>NSTimer</code>.
  Could anyone give me some advice about my problem?? Thanks in advance!</p>