title: Why won't a CATransition work if it's added to the subview's layer directly after the subview is added?
body: <p>For some reason, a CATransition won't animate if the animation is added to the subview's layer directly after the subview is added:</p>
  
  <pre><code>transitionView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  [transitionView setBackgroundColor:[UIColor redColor]];
  [[self contentView] addSubview:transitionView];
  
  CATransition *animation = [CATransition animation];
  [animation setDelegate:self];
  [animation setType:@"cube"];
  [animation setDuration:1.0];
  [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
  [animation setSubtype:@"fromRight"];
  
  [[transitionView layer] addAnimation:animation forKey:nil];
  </code></pre>
  
  <p>But if the animation is added after a slight delay:</p>
  
  <pre><code>transitionView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  [transitionView setBackgroundColor:[UIColor redColor]];
  [[self contentView] addSubview:transitionView];
  
  CATransition *animation = [CATransition animation];
  [animation setDelegate:self];
  [animation setType:@"cube"];
  [animation setDuration:1.0];
  [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
  [animation setSubtype:@"fromRight"];
  
  [self performSelector:@selector(animate) withObject:nil afterDelay:0.00001];
  </code></pre>
  
  <p>-</p>
  
  <pre><code>- (void)animate
  {
      CATransition *animation = [CATransition animation];
      [animation setDelegate:self];
      [animation setType:@"cube"];
      [animation setDuration:1.0];
      [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
      [animation setSubtype:@"fromRight"];
  
      [[transitionView layer] addAnimation:animation forKey:nil];
  }
  </code></pre>
  
  <p>The transition will work as expected. Is there any reason for this?</p>