首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Map MKAnnotaionView自定义

Map MKAnnotaionView自定义
EN

Stack Overflow用户
提问于 2011-08-29 20:07:05
回答 2查看 214关注 0票数 0

自定义注解视图,就像yelp应用程序一样,有很多细节。Yelp

有没有像截图那样定制注解视图的教程?

请帮帮忙。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-08-29 20:11:42

最近,我不得不使用MKMapView开发了一个使用自定义标注(注解)的应用程序。如果你想对MKAnnotationView进行大量的定制,你将无法实现它的子类化。

对我帮助最大的是那些教程:

入门教程http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial

第1部分http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/

第2部分http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-2/ (还处理标注中的按钮)

票数 -1
EN

Stack Overflow用户

发布于 2011-08-29 20:12:12

尝试以下代码:

代码语言:javascript
运行
复制
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
    MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
    annView.pinColor = MKPinAnnotationColorPurple;
    annView.animatesDrop=TRUE;
    annView.canShowCallout = YES;
    annView.calloutOffset = CGPointMake(-5, 5);

    [rightButton setImage:[UIImage imageNamed:@"demo_img.jpg"] forState:UIControlStateNormal];
    annView.leftCalloutAccessoryView=rightButton;//add image on mapView
    return annView;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7229841

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档