ios 百度地图集成
来源:互联网 发布:大熊猫脾气 知乎 编辑:程序博客网 时间:2024/06/10 07:50
用cocoapods导入百度地图
platform :ios, ‘8.0’
use_frameworks!
target 'mapBaiDu' do
pod 'AFNetworking'
pod 'BaiduMapKit','~> 3.2.1'
end
:wq保存退出
pod install
//
// AppDelegate.m
// mapBaiDu
//
// Created by 孙璐 on 17/3/14.
// Copyright © 2017年 孙璐. All rights reserved.
//
#import "AppDelegate.h"
#import <BaiduMapAPI_Base/BMKMapManager.h>
@interface AppDelegate ()
{
BMKMapManager* _mapManager;
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
_mapManager = [[BMKMapManageralloc]init];
// 如果要关注网络及授权验证事件,请设定 generalDelegate参数
BOOL ret = [_mapManagerstart:@"申请的key" generalDelegate:nil];
if (!ret) {
NSLog(@"manager start failed!");
}
returnYES;
}
@end
//
// ViewController.m
// mapBaiDu
//
// Created by 孙璐 on 17/3/14.
// Copyright © 2017年 孙璐. All rights reserved.
//
#import "ViewController.h"
#import <BaiduMapAPI_Map/BMKMapView.h>
#import <BaiduMapAPI_Location/BMKLocationService.h>
@interface ViewController ()<BMKLocationServiceDelegate>
{
BMKLocationService * locService;
BMKMapView* mapView ;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
mapView = [[BMKMapViewalloc]initWithFrame:CGRectMake(0,0, 320,480)];
[mapViewsetMapType:BMKMapTypeStandard];
self.view =mapView;
//初始化BMKLocationService
locService = [[BMKLocationServicealloc]init];
locService.delegate =self;
//启动LocationService
[locServicestartUserLocationService];
mapView.showsUserLocation =YES;//显示定位图层
mapView.userTrackingMode =BMKUserTrackingModeHeading;
[mapViewsetZoomLevel:25];
}
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
{
[mapViewupdateLocationData:userLocation];
mapView.centerCoordinate = userLocation.location.coordinate;
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- iOS- 集成百度地图
- ios 百度地图集成
- iOS 集成百度地图
- iOS开发集成百度地图
- iOS 开发之集成百度地图
- iOS 百度地图开发集成使用
- iOS 百度地图开发集成使用 (转)
- iOS讲解迷惑之集成百度地图
- iOS开发百度地图SDK集成方法
- iOS百度地图简单集成使用
- iOS集成百度地图方法步骤
- iOS开发之集成百度地图
- iOS毕业设计—百度地图的集成
- 百度地图集成
- 集成百度地图
- 百度地图集成
- 百度地图集成
- 集成百度地图sdk
- Linux命令格式及帮助命令详解
- sql优化
- mysql 数据库查询今天、昨天、上月、本月的数据
- js获取当前时间:yyyy-MM-dd HH:MM:SS
- web知识-根据用户的设备自动选择质量不同的图片。
- ios 百度地图集成
- Android WebView 缓存处理
- 经典机器学习算法系列2-朴素贝叶斯法
- java.lang.IllegalArgumentException: Page directive: invalid value for import
- 4G全网通安卓智能核心板模块 MTK6735方案
- 搜索引擎的基本工作原理
- Macdown工具的常用命令以及快捷键
- Json对象与Json字符串相互转化
- linux网络编程之用一张图片说明套接口常用函数