hello World

 

1、前期工作

      注册百度开发者帐号

      生成密钥

      下载百度地图api

      在xcode进行配置

2、让百度地图跑起

      在程序的AppDelegate代码如下:

       manger = [[BMKMapManageralloc]init

              ];

        self.controller = [[ViewController alloc]init];

        self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];

        self.window.rootViewController = self.controller;

        [mangerstart:@"501eb48add5a59e.."generalDelegate:nil]; //进行验证,如果想关注网络和验证结果请         实现委托

 

        这里需要注意的是将Appdelegate.m文件改为AppDelegate.mm文件

3、在ViewController里的ViewDidLoad函数里代码如下

       [superviewDidLoad];

       BMKMapView *mapView = [[BMKMapViewalloc]initWithFrame:[[UIScreenmainScreen] bounds]];

 

       [self.view addSubview:mapView];

 

       到这里百度地图就可以在iphone上跑起来了。

 

 

 

 

你可能感兴趣的:(Hello world)