我正在尝试设置区域,但是当我设置区域时,地图冻结并且我无法移动地图...
这是我的代码
-(void) configurarZoomDoMapaComLatitude:(double)latitude eLongitude:(double)longitude {
_myMapView.userInteractionEnabled = YES;
CLLocation *localizacao = [[CLLocation alloc]initWithLatitude:latitude longitude:longitude]; //regiao de ref. (usar localizacao atual)
double miles = 0.5; // quanto menor, mais próximo
double scalingFactor = ABS( (cos(2 * M_PI * localizacao.coordinate.latitude / 360.0) ));
MKCoordinateSpan span;
span.latitudeDelta = miles/69.0;
span.longitudeDelta = miles/(scalingFactor * 69.0);
MKCoordinateRegion region;
region.span = span;
region.center = localizacao.coordinate;
[_myMapView setRegion:region animated:YES];
}