13

アプリケーション マップ ページに要件があります。吹き出しの吹き出しをカスタマイズする必要があります。画像、2 つのラベル、およびそれぞれ特定の高さと幅を持つボタンを追加する必要があります。

Web を調べましたが、吹き出しの吹き出しをカスタマイズする方法を説明する適切なリンクが見つかりませんでした。誰かが遭遇したり、それについて知っている場合は、私と共有してください.

簡単な例やリンクは本当に素晴らしいでしょう。

よろしくお願いします

4

1 に答える 1

21

あなたを助けるための例:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{   
    MKAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"loc"];

    // Button
    UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    button.frame = CGRectMake(0, 0, 23, 23);
    annotationView.rightCalloutAccessoryView = button;

    // Image and two labels
    UIView *leftCAV = [[UIView alloc] initWithFrame:CGRectMake(0,0,23,23)];
    [leftCAV addSubview : yourImageView];
    [leftCAV addSubview : yourFirstLabel];
    [leftCAV addSubview : yourSecondLabel];
    annotationView.leftCalloutAccessoryView = leftCAV;

    annotationView.canShowCallout = YES;

    return annotationView;
}

詳細については、こちらをご覧ください: http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKAnnotationView_Class/Reference/Reference.html%23//apple_ref/occ/cl/MKAnnotationView

于 2010-11-04T08:38:07.973 に答える