Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

freakmoister

macrumors newbie
Original poster
Dec 2, 2011
3
0
I'm trying to figure out why the track bar button won't move the map back to user current location. It just changes to the waiting spin wheel (picture below) and the map doesn't move either. thanks.

eI88v.png



Part of my code below. The co-ords there is for the city centre, but I've set my simulator's location to another place, so if I click on the track bar button I expect to move there.
Code:
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        [self focusMap];
        self.mapView.showsUserLocation = YES;
    }    
    - (void) focusMap 
    {
        CLLocationCoordinate2D coord = { -33.882365, 151.211025 };
        MKCoordinateSpan span = {0.005,0.005};
        MKCoordinateRegion region = {coord, span};
        [mapView setRegion: region animated: YES];
        
        MKUserTrackingBarButtonItem* trackerButton = [[MKUserTrackingBarButtonItem alloc] initWithMapView: self.mapView];
        self.navigationItem.rightBarButtonItem = trackerButton;
        [trackerButton release];
        
        mapView.zoomEnabled = YES;
    }
 
Did you try moving "mapView.zoomEnabled = YES;" before setting the location?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.