Show mapview in zoomed in mode the very first time

Discussion in 'iOS Programming' started by RookieAppler, Jan 31, 2013.

  1. RookieAppler, Jan 31, 2013
    Last edited: Jan 31, 2013

    macrumors member

    Joined:
    Mar 15, 2012
    #1
    I am trying to load the mapview in zoomed in mode on first time. I save a record with my current location in zoomed in mode.Close it.Open a new record, give the mapview a new location(2 blocks from my current location).Save it. So i have 2 records now. I open the first record, and it shows me an annotation in world view mode. I open the second record and it shows me that location which i saved for 2nd record in zoomed in mode. I close the 2nd one ,go back and now open the first record and it shows location in zoomed in mode. So how do i get to open the mapview in zoomed in mode the very first time?
    If you need more info,please ask.Thanks.
    Code:
    - (void)setDraggablePinOnMap:(CLLocationCoordinate2D)currentCoordinates
    {
     	NSLog(@"458 the current lat is %f", currentCoordinates.latitude);
    	NSLog(@"459 the current long val is %f", currentCoordinates.longitude);
    	
     	[self.nwMapView setMapType:MKMapTypeSatellite];
    
    	[self.nwMapView setScrollEnabled:YES];
    	
    	MKCoordinateRegion extentsRegion = MKCoordinateRegionMakeWithDistance(currentCoordinates, 80, 80);
    	extentsRegion.span.longitudeDelta = 0.002f;
    	extentsRegion.span.latitudeDelta = 0.002f;
    	
    	[self.nwMapView setRegion:extentsRegion animated:NO];
    	ITMAnnotation *annotation = [[ITMAnnotation alloc] initWithCoordinate:currentCoordinates addressDictionary:nil];
    	annotation.title = @"Drag to Move Pin";
    	annotation.subtitle = [NSString	stringWithFormat:@"%f %f", annotation.coordinate.latitude, annotation.coordinate.longitude];
    	NSLog(@"subtitle change at 314");
    	
    	[self.nwMapView addAnnotation:annotation];
    	self.tempMapView = self.nwMapView;
    }
    
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Is setDraggablePinOnMap: the only place you are calling your mapView's setRegion:animated:? How/where is this method triggered? Also, what is your mapView's userTrackingMode?
     

Share This Page