title: How to get center of an MKMapView map?
body: <p>I have an MKMapView which allows the user to scroll the map around. Later, I want to get the latitude and longitude of the point at the center of the map, but can't find an easy way to do it. At the moment I'm trying something like:</p>
  
  <pre><code>CLLocationCoordinate2D centre = [locationMap convertPoint:locationMap.center toCoordinateFromView:locationMap];
  txtLatitude.text = [NSString stringWithFormat:@"%f",centre.latitude];
  txtLongitude.text = [NSString stringWithFormat:@"%f",centre.longitude];
  </code></pre>
  
  <p>But it's not working - both latitude and longitude both come out as zero. I'd be grateful for any ideas anyone might have!</p>
  
  <p>==============</p>
  
  <h1>-- Update 1 --</h1>
  
  <p>Oh. If I add the:</p>
  
  <pre><code>NSLog(@"%@", locationMap);
  </code></pre>
  
  <p>line as suggested below, the log shows "(null)". I've got the following in my header (amongst other things):</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;MapKit/MapKit.h&gt;
  #import &lt;CoreLocation/CoreLocation.h&gt;
  
  IBOutlet MKMapView *locationMap;
  
  @property (nonatomic, retain) IBOutlet MKMapView *locationMap;
  </code></pre>
  
  <p>and the following in my methods file:</p>
  
  <pre><code>@synthesize locationMap;
  </code></pre>
  
  <p>This is compiling without any warnings or errors at present. Starting to wonder if I've missed something obvious?</p>