Custom MKAnnotationView z ramką, ikoną i obrazem
Szukałem podobnego rozwiązania dotyczącego projektowania niestandardowego MKAnnotationView, takiego jak ten.
Podklasowałem MKAnnotation i udało mi się dodać obraz o nazwie F.png F.png to obraz klatki, jak pokazano na obrazku. chcę dodać wewnętrzny obraz. (w kolorze niebieskim na rysunku rysuję)
<code>- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; static NSString* AnnotationIdentifier = @"AnnotationIdentifier"; MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier]; if(annotationView) return annotationView; else { MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier]; annotationView.canShowCallout = YES; annotationView.image = [UIImage imageNamed:[NSString stringWithFormat:@"F.png"]]; UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(writeSomething:) forControlEvents:UIControlEventTouchUpInside]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; annotationView.rightCalloutAccessoryView = rightButton; annotationView.canShowCallout = YES; annotationView.draggable = NO; return annotationView; } return nil; } </code>