title: Make half of UIView go out of screen
body: <p>I created a floating view for my application which always displays on screen.</p>
  
  <p>Now I want to make a half of it go outside my screen when it is interactive for 3-4 seconds. I think I should use a <code>NSTimer</code> to hide out this view, but it is not the problem.</p>
  
  <p>The problem is how should I set <code>origin.x</code> of this view to go outside of the screen? I've tried to set the frame in my <code>initWithSuperView</code> like this:</p>
  
  <pre><code>CGRect screenRect = [[UIScreen mainScreen] bounds];
  CGFloat screenX = screenRect.origin.x;
  [self setFrame:CGRectMake(-screenX - size.width, 0, size.width, size.height)];
  </code></pre>
  
  <p>However, it doesn't work. How should I do it to get my desired result? See image below for more information:</p>
  
  <p><a href="https://i.stack.imgur.com/lLfko.png" rel="nofollow"><img src="https://i.stack.imgur.com/lLfko.png" alt="enter image description here"></a></p>