title: MKMapView and viewDidLoad/viewWillAppear/viewDidAppear using Storyboards
body: <p>I have a ViewController with a MapView, the controller is initialized by a segue specified in the storyboard. The MapView is connected (via Storyboard) to a property in the controller.</p>
  
  <hr>
  
  <p>.h file</p>
  
  <pre><code>@interface DetailViewController : UIViewController &lt;MKMapViewDelegate&gt;
  
  @property (weak, nonatomic) IBOutlet MKMapView *locationMapView;
  </code></pre>
  
  <p>I am using a method to center the MapView to a specific region:</p>
  
  <pre><code>- (void)centerMapView
  {
      MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(CLLocationCoordinate2DMake(geoPoint.latitude, geoPoint.longitude), 1000, 1000);
      [self.locationMapView setRegion:region animated:NO];
  
      NSLog(@"size height: %f",self.locationMapView.frame.size.height);
      NSLog(@"size width: %f",self.locationMapView.frame.size.width);
  }
  </code></pre>
  
  <p>Calling this method from <code>viewDidLoad</code>/<code>viewWillAppear</code> does nothing for the first time, but centers it correctly for the second time the View is loaded.
  The Log output is always:</p>
  
  <pre><code>size height: 0.000000
  size width: 0.000000
  </code></pre>
  
  <p>When called in <code>viewDidAppear</code> the MapView is centered and the output size is correct:</p>
  
  <pre><code>size height: 400.000000
  size width: 320.000000
  </code></pre>
  
  <p>I guess the size values mean that the view is not yet initialized in <code>viewDidLoad</code>/<code>viewWill</code> appear, this might be unrelated to the my problem with setting the region.</p>
  
  <p>I am wondering, if it is really not possible to set the region of the MapView in <code>viewDidLoad</code>/<code>viewWillAppear</code> so the user does not see a changing of the region.</p>
  
  <p>Any advice?</p>