我对iPhone的编程很陌生,但我在其中制作了一个只有MKMapView的应用程序.我让它放大到我的位置但我不断更新位置.我的观点是,我希望它停止自动定位我,它仍然可以继续,但我只想让它停止定位.当我向任何方向滑动时,它会迫使我回到我的位置,或者当我散步并更新位置时.我的想法是,我希望应用程序使用一些注释.
- (void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
NSLog(@"Found your location!");
MKCoordinateRegion mapregion;
map.showsUserLocation = YES;
mapregion.center.latitude = map.userLocation.coordinate.latitude;
mapregion.center.longitude = map.userLocation.coordinate.longitude;
mapregion.span = MKCoordinateSpanMake(0.005,0.005);
[map setRegion:mapregion animated:YES];
map.userLocation.title = @"You're here";
// map.mapType = MKUserTrackingModeNone;
// (found this on apple developer site, I think this can
// help but I have no clue at all //someone know what you can use this for?)
}
// In case you have the flightmode on...
- (void)mapView:(MKMapView *)mapView didFailToLocateUserWithError:(NSError *)error
{ …Run Code Online (Sandbox Code Playgroud)