遇到的问题
1.初始化地图
2.设置地图定位小蓝点
- (void)initMapView
{
if (self.mapView == nil)
{
self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
self.mapView.delegate = self;
}
self.mapView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:self.mapView];
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = 2;
self.mapView.visibleMapRect = MAMapRectMake(220880104, 101476980, 272496, 466656);
}
地图打开后 默认显示在北京 定位小蓝点没有起作用
原因在于
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = 2;
应当放在最后面
- (void)initMapView
{
if (self.mapView == nil)
{
self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
self.mapView.delegate = self;
}
self.mapView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:self.mapView];
self.mapView.visibleMapRect = MAMapRectMake(220880104, 101476980, 272496, 466656);
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = 2;
}
地图所有属性都设置完后 再设置定位小蓝点 问题解决
网友评论