地图setRegion时冻结MKMapView

时间:2013-02-21 15:05:40

标签: ios objective-c iphone-developer-program

我正在尝试setRegion,但是当我设置区域时,地图会冻结,我无法移动地图......

这是我的代码

 -(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];
}

1 个答案:

答案 0 :(得分:-2)

我已经解决了这个问题...我在地图中添加了一个视图...我删除它并且它有效!全部