1

私はこのような方法を持っています:

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

            UIStoryboard *Mystoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
            CTObjectCreationVC *content = [Mystoryboard instantiateViewControllerWithIdentifier:TEST];
            content.modalInPopover = YES;

            content.contentSizeForViewInPopover = CGSizeMake(500, 300);
            self.myPopoverController = [[UIPopoverController alloc] initWithContentViewController:content];
            [self.myPopoverController presentPopoverFromRect:control.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown animated:YES];
    }

ポップオーバーを表示するためのフレームを取得する必要があります(MKAnnotationView *)view。しかし、私はこのような非常に奇妙なフレームを持っています:

MKPinAnnotationView: 0x1c600800; フレーム = (633571 327938; 32 39); タグ = 3;

なんで?X と Y が非常に大きいのはなぜですか? 実数の X と Y を取得するにはどうすればよいですか? ありがとう

ログ

2013-10-23 14:05:52.794 ビュー フレーム: MKPinAnnotationView: 0x1f8c2160; フレーム = (633548 328139; 32 39); タグ = 17; GestureRecognizers = NSArray: 0x1f8c2490>; レイヤー = MKLayer: 0x1f8c21c0 >> 可視:1 +55.68109131、+37.51455307

4

1 に答える 1

0

デリゲートが呼び出される前にこのフレームを取得していると思いますが、

NSLogこのメソッドに入れて、そのフレームが何であるかを確認します。

   - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIButton *)control
    {
         NSLog("view frame:%@",view);
    }
于 2013-10-23T09:48:32.900 に答える