地图显示
在显示地图之前需要预先导入res 和 data 资源数据包 (注: 此资源包只能以 folder 的形式引入 , 作为资源引进项目;若有packet.dat务必移除)
显示3D矢量地图,代码示例如下:
(完整代码请参见 SDKDemo 工程的 MBMapController.m 文件) #import <iNaviCore/MBMapView.h> @interface MBMapController () // 地图视图 @property (nonatomic ,strong) MBMapView *mapView; } - (void)viewDidLoad { [super viewDidLoad]; [self initMapView]; } - (void)initMapView { if (baseMapView == nil) { baseMapView = [[MBMapView alloc]initWithFrame:self.view.bounds]; [self.view addSubview:baseMapView]; } [baseMapView setZoomLevel:8.0 animated:YES]; [baseMapView loadStyleSheet:@"res/map4_style_sheet.json"]; [baseMapView setStyleClass:@"DEFAULT"]; baseMapView.delegate = self; }
3D矢量地图显示效果: