سؤال

أريد إضافة شرح إلى 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