pat*_*boy 6 annotations objective-c mkmapview ios7
我们在其中一个应用中看到了一个意外的行为 - 一个屏幕我们在地图视图上显示注释,用户可以通过单击按钮更改显示的注释.
当我们使用iOS7重建应用程序时,屏幕会定期冻结,即一旦下面的代码被多次调用(使用不同的注释集),MKMapView上就不再有用户输入了 - 视图嵌入了标签栏和导航控制器及其所有UI元素仍然有效,但mapview本身不接受任何用户输入(捏/缩放).
显示注释的代码位于:
[self.mapView removeAnnotations:self.mapView.annotations];
for (MyObject *my in self.mydata)
{
MyAnnotation *annotation = [MyAnnotationFactory createAnnotationFor:my];
[self.mapView addAnnotation:annotation];
}
CLLocationCoordinate2D mycenter;
mycenter.latitude = -38.967659;
mycenter.longitude = 172.873534;
[self.mapView setRegion:MKCoordinateRegionMake(mycenter, MKCoordinateSpanMake(15, 18))
animated:YES];
[self.mapView setCenterCoordinate:mycenter];
Run Code Online (Sandbox Code Playgroud)
我发现通过设置区域而不设置动画,即通过将上面的代码更改为
__CODE__仅__CODE__在B中的except块中,然后python2.7给出完整的回溯.我的猜测是,当为python2.7反向移植这个模块时,异常传播的差异被忽略了.
小智 -1
尝试在主线程的函数中运行 setRegion:
[self performSelectorOnMainThread:@selector(animateMapRegion) withObject:nil waitUntilDone:NO];
-(void)animateMapRegion
{
CLLocationCoordinate2D mycenter;
mycenter.latitude = -38.967659;
mycenter.longitude = 172.873534;
[self.mapView setRegion:MKCoordinateRegionMake(mycenter, MKCoordinateSpanMake(15, 18)) animated:animated];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
713 次 |
| 最近记录: |