找到当前位置时的蓝点和圆圈

时间:2009-10-05 22:12:11

标签: objective-c iphone gps core-location

当您找到当前位置时,是否有人知道如何为Google地图设置蓝色圆圈/点的动画效果?我在一个不同的iPhone应用程序中看到了这一点,并想知道如何使用iPhone SDK 3.0以编程方式创建动画和外观?任何人都可以对此有所了解吗?示例代码很棒。

1 个答案:

答案 0 :(得分:0)

在我的应用程序中,我使用了以下代码将地图缩放到当前用户位置,同时显示您需要的蓝点/圆圈。

在标头文件中:@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