iOS Developer

iOS 地图不能拖动

2017-07-20  本文已影响138人  IMKel
bug重现

当APP登录完毕进入地图界面之后,点击退出登录按钮,使用presentViewController:animated:completion:方法来到了登录界面,然后再次输入账号密码登录来到地图界面,此时地图就无法拖动了。

解决方法

在地图所在控制器对地图一些代理进行处理就可以解决问题了,代码如下:

#pragma mark - viewWillAppear:
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    self.cloudSearch.delegate = self;//BMKCloudSearch对象的代理
    self.mapView.delegate = self;//BMKMapView对象的代理
    self.geoCodeSearch.delegate = self;//BMKGeoCodeSearch对象的代理
}

#pragma mark - viewWillDisappear:
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    self.cloudSearch.delegate = nil;//BMKCloudSearch对象的代理
    self.mapView.delegate = nil;//BMKMapView对象的代理
    self.geoCodeSearch.delegate = nil;//BMKGeoCodeSearch对象的代理
}
上一篇 下一篇

猜你喜欢

热点阅读