質問

私はそれに開示ボタンでのMapViewに注釈を追加したいと私はそれを把握することはできません。

私は目印をMKAnnotationプロトコルに準拠し、その後のMapViewを作成し、追加目印クラスを作成しています:

// Add annotation information
PlaceMark *venuePlacemark = [[PlaceMark alloc] initWithCoordinate:location];
venuePlacemark.locationTitle = [locationDictionary valueForKey:VENUE_NAME_KEY];
venuePlacemark.locationSubtitle = @"Touch to show in Google Maps";

// Create the accessory button on the placemark
[venueMap addAnnotation:venuePlacemark];
[venueMap setRegion:region animated:TRUE];
[venueMap regionThatFits:region];

このすべての作品とピンがするときは、ディスプレイに正しいコールアウトテキストに触れたことが表示されます。私は、コールアウトに開示ボタンを追加する方法を見つけ出すことはできません。申し訳ありませんが、これは基本であり、任意の助けいただければ幸い場合ます。

デーブ

役に立ちましたか?

解決

私はそれを考え出した...以下のデリゲートメソッドを実装考えます

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

    UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [disclosureButton addTarget:self action:@selector(mapCallOutPressed:) forControlEvents:UIControlEventTouchUpInside];

    dropPin.rightCalloutAccessoryView = disclosureButton;
    dropPin.animatesDrop = YES;
    dropPin.canShowCallout = YES;

    return dropPin;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top