title: Rotation Animations for background views overlaps button in foreground
body: <p>I created a animation to switch locations. The animation works fine, but it destroys the button in the foreground. </p>
  
  <p>The button should not be affected. What is causing this?</p>
  
  <p><img src="https://i.stack.imgur.com/4oL9k.gif" alt="enter image description here"></p>
  
  <p>a <a href="https://drive.google.com/a/goeuro.com/file/d/0B5R6qXDaqLpWeEdhSVNRMjN4M00/view" rel="nofollow noreferrer">video</a></p>
  
  <pre><code> CGFloat speedFactor = 3.0;
   CABasicAnimation *slotAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
   [slotAnimation setToValue:[NSNumber numberWithFloat:M_PI_2]];
   [slotAnimation setRemovedOnCompletion:NO];
   [slotAnimation setFillMode:kCAFillModeBoth];
   slotAnimation.duration = .3 / speedFactor;
   [[self.fromPositionTextField layer] addAnimation:slotAnimation forKey:@"slotAnimation"];
  
   CABasicAnimation *slotAnimation2 = [slotAnimation copy];
   [slotAnimation2 setBeginTime:CACurrentMediaTime()+0.3 / speedFactor];
   [[self.toPositionTextField layer] addAnimation:slotAnimation2 forKey:@"slotAnimation"];
   dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.6 / speedFactor * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
       NSArray *positions = @[self.viewModel.fromPosition, self.viewModel.toPosition];
       self.viewModel.fromPosition = positions[1];
       self.viewModel.toPosition = positions[0];
  
       CABasicAnimation *slotAnimation3 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
       [slotAnimation3 setToValue:[NSNumber numberWithFloat: M_PI *.125/4.0]];
       [slotAnimation3 setRemovedOnCompletion:NO];
       [slotAnimation3 setFillMode:kCAFillModeBoth];
       slotAnimation3.duration = .3 / speedFactor;
       [slotAnimation3 setBeginTime:CACurrentMediaTime()+0.3 / speedFactor];
       [[self.fromPositionTextField layer] addAnimation:slotAnimation3 forKey:@"slotAnimation2"];
  
       CABasicAnimation *slotAnimation4 = [slotAnimation3 copy];
       [slotAnimation4 setBeginTime:CACurrentMediaTime()+0.6 /speedFactor];
       [[self.toPositionTextField layer] addAnimation:slotAnimation4 forKey:@"slotAnimation2"];
  
       dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.2/speedFactor * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
           [self.fromPositionTextField.layer removeAllAnimations];
           [self.toPositionTextField.layer removeAllAnimations];
  
       });
   });
  </code></pre>