title: On iOS, inside UIView's instance method, if we do [self removeFromSuperview], why does self continue to exist?
body: <p>If we subclass <code>UIView</code> and in any of this new class's instance methods, do</p>
  
  <pre><code>[self removeFromSuperview];
  
  [foo someMessage];
  _a = _a + 1;
  self.b++;
  for (int i = 0; i &lt; 100000000; i++) {
      self.b++;
      //NSLog(@"b is %i", self.b);
  }
  </code></pre>
  
  <p>What will happen?  Assuming the super view is the only one claiming ownership of this view, will <code>self</code> be deallocated right away? </p>
  
  <p>The first line is sending a local variable <code>foo</code> referencing an external object the message <code>someMessage</code>.  The second line is a local variable <code>_b</code>.  The third line is a property <code>b</code>.  And the next few lines are just make making some delay.</p>
  
  <p>Trying on Xcode 4.5 and iPhone 5 (iOS 6), the code actually runs without crashing.  The code was done inside of <code>-touchesBegan</code>.  The view will disappear on screen only after the big delay loop has finished, probably due to the main loop now calling <code>drawRect</code> for <code>rootViewController.view</code> and show that the view has disappeared (the view has disappeared from the view hierarchy before the delay loop, but just not reflected on screen yet).</p>
  
  <p>If I make the loop only count to 1000 or 10000, and use the <code>NSLog</code> inside that loop, the number actually prints out nicely without any crash. <strong>Update:</strong> it is said that the object may still be accessible for a short while, but it seems that even for 30 seconds or a minute, the code still run without any problem.</p>
  
  <p>So how does this work?  If using Instruments, I actually see that this <code>FooView</code> object went away from the "allocation" table only after the big delay loop.  So it is strange that it seems that the <code>FooView</code> object wasn't dealloc'ed until later, not at the point of <code>removeFromSuperView</code>.</p>
  
  <p>I also had a <code>[self.presentingViewController dismissViewControllerAnimated ...]</code> that dismissed <code>self</code>, and then the next line, <code>self.presentingViewController</code> is used again, <code>self.presentingViewController</code> became <code>nil</code>, but if I also add a loop to increment an integer property for 10000 and print it out using <code>NSLog</code>, it printed out nicely too.</p>