title: iOS: self.view.bounds does not fill the whole window
body: <p>I am doing some simple testing of adding CALayer to a UIView. In my main controller class of an iPhone 4 app, I implemented the <code>viewDidLoad</code> method as such:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      NSLog(@"%s", __PRETTY_FUNCTION__);
  
      CALayer* ca = [[CALayer alloc] init];
      [ca setBounds:self.view.bounds];
  
      [ca setBackgroundColor:[[UIColor blueColor] CGColor]];
  
      [self.view.layer addSublayer:ca];
  }
  </code></pre>
  
  <p>The blue background only occupy 1/4 of the screen. </p>
  
  <p><img src="https://i.stack.imgur.com/82MwC.png" alt="enter image description here"></p>
  
  <p>I wonder if it is because I did not take retina display into consideration? What is the best practice in this situation?</p>
  
  <hr>
  
  <p>Added these debug messages:</p>
  
  <pre><code>NSLog(@"frame w:%f h:%f", self.view.frame.size.width, self.view.frame.size.height);
  NSLog(@"bounds w:%f h:%f", self.view.bounds.size.width, self.view.bounds.size.height);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>frame w:320.000000 h:460.000000
  bounds w:320.000000 h:460.000000
  </code></pre>