我有這樣的代碼來設置地圖在用戶的位置:爲什麼MKMapView將我置於海中?
MKCoordinateSpan span;
span.latitudeDelta=0.2;
span.longitudeDelta=0.2;
CLLocationCoordinate2D location=mapView.userLocation.coordinate;
location = mapView.userLocation.location.coordinate;
MKCoordinateRegion region;
region.span=span;
region.center=location;
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
現在,當我做mapView.showsUserLocation=YES
它顯示我的位置在正確的地方(我的設備上,並在模擬器蘋果總部)然而,上面的代碼都會讓我在非洲附近的海中!
任何想法?
你檢查'mapView.userLocation.location'不是零? – FelixLam 2010-09-08 10:23:29
不......我猜這個位置還沒有添加到地圖中呢? – 2010-09-08 10:53:28