iOS Mapkit自定义标注

Bah*_*mut 8 mapkit ios

这是一个示例自定义标注,我希望得到类似的风格.我想继承MKAnnotation,但我失去了如何启动它,我不知道标注的设计是否可以被覆盖.

http://1.bp.blogspot.com/_xfo3fwc97Fg/TJ9RZrHVOaI/AAAAAAAAAU4/buhP3q3y0G4/s1600/fmip_locate_20100622.png

任何想法如何用ui控件实现这个自定义标注?

编辑:这是我的代码来自类似的StackOverflow答案:

- (MKAnnotationView *)mapView:(MKMapView *)mapview 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
    {
        UIImage *img = [UIImage imageNamed:@"default_thumb.png"];

        MKAnnotationView *annotationView = 
            [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
        annotationView.canShowCallout = YES;
        annotationView.image = img;
        annotationView.draggable = YES;

        /*
        // change left accessory view button with image
        UIImageView *leftAccView = [[UIImageView alloc] initWithImage:img];
        annotationView.leftCalloutAccessoryView = leftAccView;

        //include a right button to show more info         
        UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [rightButton addTarget:self action:@selector(calloutSubMenu:) forControlEvents:UIControlEventTouchUpInside];
        [rightButton setTitle:annotation.title forState:UIControlStateNormal];
        annotationView.rightCalloutAccessoryView = rightButton;         
         */

        return annotationView;
    }
    return nil;
}

// Customize accessory view
- (void)mapView:(MKMapView *)mapview annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
    [mapview deselectAnnotation:view.annotation animated:YES];

    PopOverCallout *popOverCallout = [[PopOverCallout alloc]init];

    UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:popOverCallout];

    self.annotationPopoverController = popOver;

    popOver.popoverContentSize = CGSizeMake(500, 500);

    [popOver presentPopoverFromRect:view.bounds inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];    
}
Run Code Online (Sandbox Code Playgroud)

(void)mapView:(MKMapView *)mapview annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
Run Code Online (Sandbox Code Playgroud)

触摸引脚时应该调用以显示标注权限吗?但是会发生一个空白的常规标注.我可能做错了什么?

BTW:UIViewController子类只在它的XIB上有一个标签,几乎是空白的.

Bah*_*mut 14

午睡几分钟后找到答案.

使用为指导,我只是需要重写

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
Run Code Online (Sandbox Code Playgroud)

它显示了注释标注.再次感谢安娜女士的回答.