title: How to center a view loaded from nib file?
body: <p>I have a view defined in a nib file. (named <code>FooView.xib</code>)</p>
  
  <p>The view is of a fixed size (smaller than screen size).</p>
  
  <p>I would like to load it in a view controller (named <code>FooViewController.[hm]</code>) and I want the view to show up in the center of the screen in whatever devices (a universal app).</p>
  
  <p>Since the name of the xib and viewcontroller class have such correspondence, the view in the xib is loaded automatically.</p>
  
  <p>Then I write code in the <code>-(void)viewDidLoad</code> method to center my view, which can be referenced by <code>self.view</code>. I write something like this.</p>
  
  <pre><code>CGRect screenBounds = [[UIScreen mainScreen]bounds];
  self.view.center = CGPointMake(screenBounds.size.width/2, screenBounds.size.height/2);
  </code></pre>
  
  <p>And it does not work. Neither will it work when I modify <code>self.view.frame = ...</code>.</p>
  
  <p>I checked the values of <code>self.view.center</code> or <code>self.view.frame</code>. They did change but I didn't see any changes in the simulator.</p>