Maxime
Maxime

Reputation: 3165

Center the MapKitView with coordinate iOS 3.1.3

how I can center the MapKitView with coordinate in iOS 3.1.3.

With iOS 4.* I use this code but it fail with iOs 3.1.3

    MKCoordinateRegion stopRegion;
    stopRegion.center = coords;
    mapView.region = stopRegion;
    MKCoordinateSpan span;
    span.latitudeDelta = .005;
    span.longitudeDelta = .005;

Thanks!

Upvotes: 0

Views: 566

Answers (2)

Maxime
Maxime

Reputation: 3165

I have found a good answer work with ios 3 and 4 :

[mapView setRegion:MKCoordinateRegionMake(coords, MKCoordinateSpanMake(.005, .005)) animated:YES];

Upvotes: 1

Bartek
Bartek

Reputation: 1996

MKCoordinateSpan span;
span.latitudeDelta = .005;
span.longitudeDelta = .005;

MKCoordinateRegion stopRegion;
stopRegion.center = coords;
stopRegion.span = span;

[mapView setRegion:stopRegion animated:YES];

Upvotes: 2

Related Questions