Пользовательский MKAnnotationView с рамкой, значком и изображением

Я искал похожее решение о том, как создать собственный MKAnnotationView, подобный этому.

enter image description here

Я создал подкласс MKAnnotation и смог добавить изображение с именем F.png F.png представляет собой изображение рамки, как показано на рисунке. я хочу добавить внутреннее изображение. (на картинке я рисую синим цветом)

- (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;
}
12
задан Kassem 9 May 2012 в 18:01
поделиться

0 ответов