简体   繁体   English

自定义标注泡泡iOS

[英]Custom Callout Bubble iOS

I am developing app with mapview functionality. 我正在使用mapview功能开发应用程序。 I want to show custom pin image on mapview, click on that open custom callout bubble with image and title. 我想在mapview上显示自定义图钉图像,点击该图片和标题打开的自定义标注气泡。 With click on that callout bubble view I would like to do some functionality. 点击该标注气泡视图,我想做一些功能。 How to achieve this? 怎么做到这一点? Any help will be appreciated 任何帮助将不胜感激

Head over to CocoaControls for custom controls. 前往CocoaControls进行自定义控件。 I bet you'll find something useful for your requirement. 我打赌你会发现一些对你的要求有用的东西。

Here are some search results from CocoaControls: 以下是CocoaControls的一些搜索结果:


Custom Pin Image 自定义图像

There are already questions on SO which answer this here and here and many more. 关于SO的问题已经在这里这里以及更多内容中回答。 I daresay you'll find your answer among them. 我敢说你会在他们中找到答案。 Basically, the code is 基本上,代码是

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
    if([annotation isKindOfClass:[MKUserLocation class]])
    return nil;

    NSString *annotationIdentifier = @"CustomViewAnnotation";
    MKAnnotationView* annotationView = [mapview dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
    if(!annotationView)
    {
        annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation
                                                  reuseIdentifier:annotationIdentifier]];
    }
    annotationView.image = [UIImage imageNamed:@"map_location_pin.png"];
    annotationView.canShowCallout= YES;

    return annotationView;
}

Please check out it: https://github.com/grgcombs/MultiRowCalloutAnnotationView 请查看它: https//github.com/grgcombs/MultiRowCalloutAnnotationView

Hope, It will may help you, 希望,它可以帮助你,

:) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM