We saw unexpected behavior in one of our applications - on one screen we show annotations on the map, and the user can change the annotations on the display by pressing a button.
When we rebuild the application using iOS7, the screen will freeze regularly, i.e. MKMapView will no longer have user input as soon as the code below has been called several times (with different sets of annotations) - the view is built into both the tab bar and navigation controller, and all their user interface elements still work, but the map itself did not accept any user input (pinching / scaling).
The code displaying annotations is here:
[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];
I found that by setting the region without , animating it, i.e. changing the above code to
[self.mapView setRegion:MKCoordinateRegionMake(mycenter, MKCoordinateSpanMake(15, 18)) animated:NO];
the problem goes away and MKMapView behaves well on iOS7.
If you have an idea as to why this is happening, and why this only happens in iOS7 and not for earlier versions, I would appreciate an explanation.
source share