Sad*_*dia 11 google-maps objective-c
我正在使用谷歌地图sdk.我想在每5秒后更新引脚的gps坐标.目前我只是更新GMSMarker的位置属性.但它会产生跳跃效应.我想在地图上顺利移动标记.
这是我更新标记位置的代码
-(void)updateLocationoordinates(CLLocationCoordinate2D) coordinates
{
if (marker == nil) {
marker = [GMSMarker markerWithPosition:coordinates];
marker.icon = [UIImage imageNamed:CAR_FOUND_IMAGE];
marker.map = mapView_;
} else
marker.position = coordinates;
}
Run Code Online (Sandbox Code Playgroud)
Bre*_*ett 35
将你的else块更改为更像这样的东西:
[CATransaction begin];
[CATransaction setAnimationDuration:2.0];
marker.position = coordindates;
[CATransaction commit];
Run Code Online (Sandbox Code Playgroud)
我们允许您使用Core Animation为Google地图设置动画.
有关工作示例,请参阅AnimatedCurrentLocationViewController.{c,m}
SDK示例应用程序.
归档时间: |
|
查看次数: |
16859 次 |
最近记录: |