iOS中的ARCarMovement

这是谷歌地图上的导航示例。 在这里,标记会随着车辆在其应用程序中的uber一样转弯而移动。 使用旧的和新的坐标动画值轴承,标记正在移动。

入门

要运行此演示项目,您需要添加带有Key的最新Google Maps SDK。 您可以下载Google Maps SDK,只需将其拖放到该项目中即可。

  • Google Maps API-获取Google Maps iOS SDK

先决条件

要使用iOS版ARCarMovement构建项目,您需要7.3版或更高版本的Xcode。

用法

如下所示将Google Maps API密钥添加到AppDelegate.m

[GMSServices provideAPIKey:@"YOUR_API_KEY"]; 

将以下导入语句添加到您的ViewController.h中 ,如下所示:

 #import "ARCarMovement.h" 

ViewController.h中创建一个ARCarMovement属性:

 @property (strong, nonatomic) ARCarMovement *moveMent; 
 //alloc 
//
self.moveMent = [[ARCarMovement alloc]init];
self.moveMent.delegate = self;

所需的数据源方法是

 /** 
* assign the specified details to be work with animation for the Marker.
*/
- (void)ARCarMovement:(GMSMarker *)marker withOldCoordinate:(CLLocationCoordinate2D)oldCoordinate andNewCoordinate:(CLLocationCoordinate2D)newCoordinate inMapview:(GMSMapView *)mapView withBearing:(float)newBearing;

所需的委托方法是

 /** 
* Tells the delegate that the specified marker will be work with animation.
*/
- (void)ARCarMovement:(GMSMarker *)movedMarker;

获得此项目:https://github.com/antonyraphel/ARCarMovement

分享反馈和想法以改进该项目,我很想听听他们的意见。 您也可以通过@ antonypr717关注我。