导入高德地图的库Extern
配置Build Settings:
other linker Flags写入-ObjC -lMAMapKit -lMASearchKit
C++ Standard library选择Compiler default
简单使用:
#import <UIKit/UIKit.h>
#import "MAMapKit.h"
@interface ViewController : UIViewController<MAMapViewDelegate>
@property (strong, nonatomic) MAMapView *mapView;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
self.mapView.delegate = self;
[self.view addSubview:self.mapView];
// 使用当前位置
self.mapView.showsUserLocation = YES;
}
ok!注意红字部分