title: ios - sendSubviewToBack and bringSubviewToFront causes subviews of root view controller to move up and be overlapped by navigation bar
body: <p>I have a problem with sendSubviewToBack and bringSubviewToFront calls. I create UIImageView and ScrollView with several other elements (like buttons and labels) programmaticaly (only ScrollView is created in storyboard). UIImageView have to hold a background image. ScrollView and UIImageView are added as subviews of view controller (other elements are subviews of scrollview). After I create a UIImageView and set the image like this, I call</p>
  
  <pre><code>self.backgroundImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)];
  [self.backgroundImage setImage:[UIImage imageNamed:@"chooseDoctorBackground"]];
  [self.view addSubview:self.backgroundImage];
  [self.view sendSubviewToBack:self.backgroundImage];
  </code></pre>
  
  <p>After that, scroll view "moves up" and becomes overlapped by navigation bar (it doesn't happening if we won't call sendSubviewToFront). There is an easy workaround - just to define position of UIImageView and UIScrollView explicitly (using setFrame) with consideration of navigation bar and status bar height. However, I don't understand the root cause of such behavior. Could you please explain it to me?</p>
  
  <p>Thanks in advance! </p>