MapKitのアノテーションからポップオーバーする

iPadプログラミングでちょっと試行錯誤したのでメモ。
convertRectでAnnotationViewのframeの座標をmapView上の座標に変更している部分が肝。

- (void)showPopover:(SomeContentViewController *)contentViewController
        fromAnnotationView:(MKAnnotationView *)annotationView
        onMapView:(MKMapView *)mapView
{
  UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController: contentViewController];
  [popoverController setPopoverContentSize:CGSizeMake(320, 480)];

  [popoverController presentPopoverFromRect:[annotationView.superview convertRect:annotationView.frame toView:mapView]
                                     inView:mapView
                   permittedArrowDirections:UIPopoverArrowDirectionAny
			                       animated:YES];
}

これでアノテーション(ピン)からふきだしが出ているように見える。

しかしObjective-Cのサンプルコードを抜き出すのはなんか難しいな。
動いてるコードから書き換えた部分があるので動かなかったら適当に直すってことで。