title: Auto zoom in resets when the user zooms out
body: <p>I made a Map to show the user location with an auto zoom in, however when the user try to zoom out, it was zooming in automtically which is not practical,can you help me <strong>to disable the auto zoom in when the user zoom out ?</strong>. Here is part of my code :</p>
  
  <pre><code>    - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
          // store new user location
          location = newLocation.coordinate;
          //move the map to the new user location
          MKCoordinateRegion region;
          region.center = location;
          // zoom level
          MKCoordinateSpan span;
          span.latitudeDelta = .005;
          span.longitudeDelta = .005;
          region.span = span;
          // apply new coordinates
          [mapView setRegion:region animated:TRUE];
  
  }
  </code></pre>
  
  <p><strong>Edited:</strong>
  I added this statement in the viewDidLoad:</p>
  
  <pre><code>mapView.zoomEnabled=FALSE;
  </code></pre>
  
  <p>should it disable the auto zoom in when the user zoom out ?</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      //
      // On veut afficher la position courante de l'utilisateur
      [mapView setShowsUserLocation:TRUE];
      // MKMapTypeStandard est un mode d'affichage parmis 3 disponibles
      // (les deux autres sont MKMapTypeSatelitte et MKMapTypeHybrid et MKMapTypeStandard)
      [mapView setMapType:MKMapTypeHybrid];
      // Le fait de setter le Delegate permet d'appeler méthodes implémentées dans cette classe
      [mapView setDelegate:self];
      // On ajoute la View du mapView a la View du controlleur courant afin de faire afficher la carte
      [self.view insertSubview:mapView atIndex:0];
  
      // CLLocationManager permet la gestion de la position géographique de l'utilisateur
      CLLocationManager *locationManager=[[CLLocationManager alloc] init];
      // Le fait de setter le Delegate permet d'appeler méthodes implémentées dans cette classe
      [locationManager setDelegate:self];
      // Définit l'échelle de distance à prendre en compte pour le raffraichissement de la position courante
      [locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
  
      [locationManager startUpdatingLocation];
      mapView.zoomEnabled=FALSE;
  
  
      }
  </code></pre>
  
  <p><strong>Edit:</strong>
  I'm still working on this, so before continuing, I want to show you my logic and I'm waiting for your advices :)
  So, in my view which is charged to show me user location on the map, added a BOOLEAN variables to test if the user has adjusted the zoom or not.
  <strong>.h</strong></p>
  
  <pre><code>BOOL shouldAdjustZoom;
  </code></pre>
  
  <p>and for the methods :</p>
  
  <pre><code>-(void)zoomLevelForMapRect:(MKMapRect)mRect withMapViewSizeInPixels:(CGSize)viewSizeInPixels;
  -(void)setShouldAdjustZoom:(BOOL)shouldAdjZoom;
  -(BOOL)shouldAdjustZoom;
  </code></pre>
  
  <p><strong>.m</strong></p>
  
  <p>I added the implementation of the getter <code>-(BOOL)shouldAdjustZoom</code> so this getter will call the <code>zoomLevelForMapRect</code> to know if the zoom level was changed or not.</p>
  
  <pre><code>-(BOOL)shouldAdjustZoom
  {
  
      [self zoomLevelForMapRect];
      return shouldAdjustZoom;
  
  }
  -(void)zoomLevelForMapRect:(MKMapRect)mRect withMapViewSizeInPixels:(CGSize)viewSizeInPixels    {
  
  
      NSUInteger zoomLevel=20;
      MKZoomScale zoomScale=mRect.size.width/viewSizeInPixels.width;
      double zoomExponent=log2(zoomScale);
      zoomLevel=(NSUInteger)(20-ceil(zoomExponent));
      if(zoomLevel&lt;20)
      {
  
          [self setShouldAdjustZoom:NO];
  
  
      }
  
  
  
  }
  
  
  - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
  
      location = newLocation.coordinate;
  
      MKCoordinateRegion region;
      region.center = location;
  
      if ([self shouldAdjustZoom]==YES) {
          // Use the manually defined span
          MKCoordinateSpan span;
          span.latitudeDelta = .005;
          span.longitudeDelta = .005;
          region.span = span;
      } else {
          // Keep the current span
          MKCoordinateRegion mapRegion = mapView.region;  // To get the current span
          mapRegion.center = newLocation.coordinate;
          mapView.region = mapRegion;
      }
  
      MKCoordinateSpan span;
  
      span.latitudeDelta = .005;
      span.longitudeDelta = .005;
      region.span = span;
      [mapView setRegion:region animated:TRUE];
  
  }
  </code></pre>
  
  <p>What I need to know is how should I call the <code>zoomLevelForMapRect</code> method, it's with parameters, in the getter I need to call it :</p>
  
  <pre><code> -(BOOL)shouldAdjustZoom
          {
  
              [self zoomLevelForMapRect];//how should I fix the call??
              return shouldAdjustZoom;
  
          }
  </code></pre>