title: How to implement a overlay button which is floating over the content view
body: <p>in some iPhone apps i saw a <strong>button</strong> which was <strong>floating over the content view</strong>, eg. in the app EyeEm. When the user is scrolling the content, the button remains where it is and is still an interaction element.<img src="https://i.stack.imgur.com/UjaKM.png" alt="Overlay Button which is floating over the content view"></p>
  
  <p>Ho do I implement this?  </p>
  
  <p>My approach would be: </p>
  
  <ul>
  <li>Create a view with content</li>
  <li>Put a button on it</li>
  <li><strong>But how to make the button floating?</strong></li>
  </ul>
  
  <p>edit: </p>
  
  <p>The floating seems to be the default behavior. Interestingly <code>addSubview</code> and <code>insertSubview</code> have the same behavior when placing the button... both are floating over the content.</p>
  
  
  
  <pre><code>- (void)addOverlayButton {
  UIButton *oButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [oButton addTarget:self
             action:@selector(aMethod:)
             forControlEvents:UIControlEventTouchDown];
  [oButton setTitle:@"Show View" forState:UIControlStateNormal];
  oButton.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
  [self.view addSubview:oButton];
  //[self.view insertSubview:oButton aboveSubview:_scrollView];  // same result as addSubview. 
  // Both solutions let the button float over the content. 
  }
  </code></pre>