Custom callout view for MKAnnotation?

A standard callout, a black bubble, is good, but can it be customized? For example, I would like to make a version with white bubbles.

+6
source share
1 answer

There is a great answer to this question: Setting up the MKAnnotation blow-out bubble

If this answer is given by @MathieuF:

- (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 pin; } 
+7
source

Source: https://habr.com/ru/post/894309/


All Articles