4

質問がありますか?私は混乱している!

注釈がレイアウトされているマップビューがあります。注釈のポップオーバーが必要です。

どうすればいいですか

1.ストーリーボードにポップオーバーコントローラーを作成し、デリゲートメソッドからプッシュします。2.すべてのサブビューなどで、プログラムによるポップオーバービューを作成しますか?

誰でも助けてくれる最初の方法を使いたいです。

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control

{ // UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"annotationPopUp"]; [self performSegueWithIdentifier: @"annotationPush" sender:nil]; }

4

1 に答える 1

3

mapView:didSelectAnnotationViewクラスでポップオーバー(できればプロパティ)を作成し、それを表示します。次に例を示します。

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    self.popover = [[UIPopoverController alloc] initWithContentViewController:yourViewController];

    [self.popover presentPopoverFromRect:view.bounds 
                                  inView:view   
                permittedArrowDirections:UIPopoverArrowDirectionAny 
                                animated:YES];
}
于 2012-11-13T16:47:56.907 に答える