title: drawViewHierarchyInRect:afterScreenUpdates: delays other animations
body: <p>In my app, I use <code>drawViewHierarchyInRect:afterScreenUpdates:</code> in order to obtain a blurred image of my view (using Apple’s <code>UIImage</code> category <a href="https://developer.apple.com/downloads/index.action" rel="noreferrer">UIImageEffects</a>).</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0);
  [self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES];
  UIImage *im = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  /* Use im */
  </code></pre>
  
  <p>I noticed during development that many of my animations were delayed after using my app for a bit, i.e., my views were beginning their animations after a noticeable (but less than about a second) pause compared to a fresh launch of the app.</p>
  
  <p>After some debugging, I noticed that the mere act of using <code>drawViewHierarchyInRect:afterScreenUpdates:</code> with screen updates set to <code>YES</code> caused this delay. If this message was never sent during a session of usage, the delay never appeared. Using <code>NO</code> for the screen updates parameter also made the delay disappear.</p>
  
  <p>The strange thing is that this blurring code is <em>completely unrelated</em> (as far as I can tell) to the delayed animations. The animations in question <em>do not use</em> <code>drawViewHierarchyInRect:afterScreenUpdates:</code>, they are <code>CAKeyframeAnimation</code> animations. The mere act of sending this message (with screen updates set to <code>YES</code>) seems to have globally affected animations in my app.</p>
  
  <p>What’s going on?</p>
  
  <p>(I have created videos illustrating the effect: <a href="https://dl.dropboxusercontent.com/u/1991225/Tall%20Chess%20Delay.mov" rel="noreferrer">with</a> and <a href="https://dl.dropboxusercontent.com/u/1991225/Tall%20Chess%20No%20Delay.mov" rel="noreferrer">without</a> an animation delay. Note the delay in the appearance of the "Check!" speech bubble in the navigation bar.)</p>
  
  <h1>UPDATE</h1>
  
  <p>I have created an example project to illustrate this potential bug. <a href="https://github.com/timarnold/AnimationBugExample" rel="noreferrer">https://github.com/timarnold/AnimationBugExample</a></p>
  
  <h1>UPDATE No. 2</h1>
  
  <p>I received a response from Apple verifying that this is a bug. See answer <a href="https://stackoverflow.com/a/25704861/1148702">below</a>.</p>