マップがズームインおよびズームアウトしたときにMKAnnotationViewImageのサイズを変更しますか? この方法はiOS5では成功しますが、iOS6では失敗します。
MKAnnotationViewの変換を直接変更しましたが、運がありません。MKAnnotationViewはフラッシュでのみサイズ変更されます(MKMapView内で修正すると、修正が終了した後、MKAnnotationViewは元のサイズに戻ります)。
私のコードは以下の通りです:
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
for (id <MKAnnotation>annotation in _mapView.annotations) {
// if it's the user location, just return nil.
if ([annotation isKindOfClass:[MKUserLocation class]])
continue;
// handle our custom annotations
//
if ([annotation isKindOfClass:[XPMKAnnotation class]])
{
// try to retrieve an existing pin view first
MKAnnotationView *pinView = [_mapView viewForAnnotation:annotation];
//resize the pin view
double zoomLevel = [_mapView getZoomLevel];
double scale = (1.0 * zoomLevel / 16) + 0.5;
pinView.transform = CGAffineTransformMakeScale(scale, scale);
}
}
}
iOS6でMKAnnotationViewのサイズを変更できますか?誰か知ってる?