项目介绍:
模拟汽车行驶的轨迹回放,实现思路很简单,利用的是地图原有的画线添加标注物功能完成的,定位轨迹回放,或者实时画线都是这个思路。代码标注很清楚适合新手参考。有什么意见或者交流技术(本人QQ:1531331257)。
AppDelegate.h :
[Objective-C] 查看源文件 复制代码
#import "AppDelegate.h"
#import <BaiduMapAPI_Map/BMKMapComponent.h>//引入地图功能所有的头文件
#import "YRSMapPlaybackVC.h"
//百度
#define BaiDuMapKey @"aRa1dqRCUIQTS0gkgGqCwDLatRPVtkVA"
@interface AppDelegate (){
/**百度地图管理类*/
BMKMapManager * _mapManager;
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
YRSMapPlaybackVC * MVC = [[YRSMapPlaybackVC alloc]init];
UINavigationController * nv = [[UINavigationController alloc]initWithRootViewController:MVC];
self.window.rootViewController = nv;
//初始化百度地图管理类设置百度key
_mapManager = [[BMKMapManager alloc]init];
BOOL ret = [_mapManager start:BaiDuMapKey generalDelegate:nil];
if (!ret) {
NSLog(@"manager start failed!");
}
[self.window makeKeyAndVisible];
return YES;
}
