PruitIgoe
PruitIgoe

Reputation: 6384

iOS MKMapKit init with location that is not user location

I know this is probably something simple but I can't seem to find anything on this through the internet:

All I want to do is load a map with some latitude and longitude coordinates. If someone could drop a snippet or link me to a resource I'd appreciate.

Thanks

Upvotes: 1

Views: 101

Answers (1)

Paul Cezanne
Paul Cezanne

Reputation: 8741

I hope this helps:

    CLLocationCoordinate2D zoomLocation;
    float zoom;


    CLLocationCoordinate2D longPointLightLocation;
    //the coords for Long Point Lighthouse, Provincetown, MA
    longPointLightLocation.latitude = 42.033126;
    longPointLightLocation.longitude = -70.168621;
    [mapView setCenterCoordinate:longPointLightLocation animated:NO];
    zoomLocation = longPointLightLocation;
    zoom = 50;

    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, zoom*METERS_PER_MILE, zoom*METERS_PER_MILE);
    [mapView setRegion:[mapView regionThatFits:viewRegion] animated:NO];  

Upvotes: 1

Related Questions