我爲我的項目使用了MapKit
,迄今爲止它一直很好。這是我用來顯示和居中地圖的一大塊代碼。iPhone 4和iPhone 5上不同的地圖縮放比例
CLLocation *locSouthWest = [[CLLocation alloc] initWithLatitude:southWest.latitude longitude:southWest.longitude];
CLLocation *locNorthEast = [[CLLocation alloc] initWithLatitude:northEast.latitude longitude:northEast.longitude];
CLLocationDistance meters = [locSouthWest distanceFromLocation:locNorthEast];
MKCoordinateRegion region;
region.center.latitude = (southWest.latitude + northEast.latitude)/2.0;
region.center.longitude = (southWest.longitude + northEast.longitude)/2.0;
region.span.latitudeDelta = meters/111319.5;
region.span.longitudeDelta = 0.0;
[self.mapView setRegion:region animated:YES];
的問題是,它的工作原理不同在iPhone 4 和 iPhone 。
這裏是iPhone 4(相同對的iOS5和iOS6的結果):
這裏是iPhone 5(使用相同的座標):
任何人經驗也一樣?
我注意到iPhone 5不是英文,而是iPhone 4。也許這也是一個因素? –
不是您的問題的「解決方案」,但您不需要從米手動計算增量。改用MKCoordinateRegionMakeWithDistance函數。 – Anna
@RyanPoolos不,所有語言的代碼都是一樣的。 – Michal