title: Centering map to visible area
body: <p>In my app I am adding an MKMapView as a view ontop of an UITableView. The MapView is of height 250 with a visible area of 80. 
  Whenever a location is found, I would like to center that location (annotation) in the visible area, the bottom 80px of the MapView. </p>
  
  <p>this is what I have so far: <a href="https://dl.dropbox.com/u/3077127/MapViewDemo.mov" rel="nofollow">https://dl.dropbox.com/u/3077127/MapViewDemo.mov</a></p>
  
  <p>I have tried a bunch of different things but I can't find a solution. I removed the things I have tested for now.
  This is my code:</p>
  
  <pre><code>float kMapHeaderHeight = 250.0f;
  float kMapContentInset = 80.0f;
  BOOL favFirstPositionFound = NO;
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      [self setTitle:NSLocalizedString(@"Favorites", @"FavoritesViewController")];
  
      // Set up the edit and add buttons.
      self.navigationItem.leftBarButtonItem = self.editButtonItem;
  
      self.mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, -kMapHeaderHeight, self.tableView.frame.size.width, kMapHeaderHeight)];
      [self.mapView setShowsUserLocation:YES];
      [self.mapView setDelegate:self];
      [self.mapView setUserInteractionEnabled:NO];
  
      [self.tableView addSubview:self.mapView];
  
      self.tableView.contentInset = UIEdgeInsetsMake(kMapContentInset, 0.0f, 0.0f, 0.0f);
  }
  - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
      if (scrollView.isDragging) {
          if (self.tableView.contentOffset.y &lt; kMapContentInset-((self.view.bounds.size.height/3)*2))
          {
              NSLog(@"Far enough!");
          }
      }
  }
  [...]
  - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
      location=newLocation.coordinate;
  
      MKCoordinateRegion region;
      region.center=location;
  
      MKCoordinateSpan span;
  
      if (!favFirstPositionFound)
      {
          span.latitudeDelta=.010;
          span.longitudeDelta=.010;
      }
      else {
          span.latitudeDelta = self.mapView.region.span.latitudeDelta;
          span.longitudeDelta = self.mapView.region.span.longitudeDelta;
      }
  
      region.span=span;
  
      favFirstPositionFound = YES;
      [self.mapView setRegion:region animated:YES];
  
      [self.locationManager stopUpdatingLocation];
  }
  </code></pre>