关于百度地图打点

1.添加百度地图framwork;
2.添加依赖库


关于百度地图打点_第1张图片
A35F4C36-5248-4FFC-9843-75AB26391918.png

//初始化BMKMapView
mapObj = [MapObj sharedMapObj];
mapObj.bmkMapView.frame =CGRectMake(0,0, self.view.frame.size.width,self.view.frame.size.height-64);

//mapObj.bmkMapView = [[BMKMapView alloc] initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 64)];
mapObj.bmkMapView.buildingsEnabled = YES;//设定地图是否现显示3D楼块效果
mapObj.bmkMapView.overlookEnabled = YES; //设定地图View能否支持俯仰角
mapObj.bmkMapView.showMapScaleBar = YES; // 设定是否显式比例尺
//_mapView.zoomLevel = 12;//设置放大级别
//_mapView.zoomLevel = 20; ///缩放级别(默认3-19,有室内地图时为3-20)
//_mapView.minZoomLevel = 14; // 限制最小缩放级别
 [mapObj.bmkMapView setZoomLevel:17];//级别,3-1
 mapObj.bmkMapView.userTrackingMode = BMKUserTrackingModeFollow;//定位跟随模式
//[self.view addSubview:mapObj.bmkMapView];
//self.view = mapObj.bmkMapView;
[mapView addSubview: mapObj.bmkMapView];

self.userLocation = [[BMKUserLocation alloc] init];
mapObj.bmkLocaService = [[BMKLocationService alloc] init];
mapObj.bmkLocaService.distanceFilter = 200;//设定定位的最小更新距离,这里设置 200m 定位一次,频繁定位会增加耗电量
mapObj.bmkLocaService.desiredAccuracy = kCLLocationAccuracyHundredMeters;//设定定位精度
//开启定位服务
[mapObj.bmkLocaService startUserLocationService];

// _mapView.userTrackingMode = BMKUserTrackingModeNone;//设置定位的状态
mapObj.bmkMapView.showsUserLocation = YES;//显示定位图层
BMKLocationViewDisplayParam *userlocationStyle = [[BMKLocationViewDisplayParam alloc] init];
userlocationStyle.isRotateAngleValid = YES;
userlocationStyle.isAccuracyCircleShow = NO;

  1.   // 回到主线程,执⾏UI刷新操作
                 for (NSDictionary *dict in responseObject[@"data"]) {
                     //YMPoi *poi = [[YMPoi alloc]init];
                     YMPoi *poi = [YMPoi mj_objectWithKeyValues:dict];
                     YMPointAnnotation *annotation = [[YMPointAnnotation alloc] init];
                     CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(poi.flat, poi.flng);
                     annotation.coordinate = coordinate;
                     annotation.poi = poi;
                     [mapObj.bmkMapView addAnnotation:annotation];
                 }

你可能感兴趣的:(关于百度地图打点)