简体   繁体   中英

Blue dot and circle when finding current location

Does anyone know how I can animate the blue circle / dot like google maps when you find your current location? I saw this in a differnt iphone application and was wondering how to programatically create that animation and look and feel using the iPhone SDK 3.0? Can anyone shed some light on this? Sample code would be great.

In my application I used follow code to Zoom map to current user location along with displaying the blue dot/circle which you require.

In header file: @property (retain, nonatomic) IBOutlet MKMapView *mapView; @property (retain, nonatomic) IBOutlet MKMapView *mapView;

// This method is called when user taps zoom button - (IBAction)zoomToUserLocation:(id)sender { self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate; MKUserLocation *userLocation = self.mapView.userLocation; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance (userLocation.location.coordinate, 300, 300); [self.mapView setRegion:region animated:NO]; } 

To update user location accordingly implement didUpdateUserLocation delegate

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
    self.mapView.centerCoordinate = mapView.userLocation.location.coordinate;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM