Skip to content

地图基本操作

显示用户定位点

用户定位点是指进入地图后,根据手机GPS的定位,把用户自身位置展示在地图上的一个标记。如果需要显示用户定位点,需要初始化地图实例后,调用showsUserLocation接口,具体步骤如下:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    DMKMapView *mapView = [[DMKMapView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:mapView];

    mapView.showsUserLocation = YES;    
}

注意:如果调用后发现用户定位点不显示,请检查App是否申请了系统定位权限