我想在MKAnnotation中添加更多详细信息,例如位置标题,描述,日期,位置名称.因此,将需要四行.但是我发现只有两个参数可以传递给MKAnnotation,即title和subtitle.如何在地图上添加更多详细信息? 请帮助我。。谢谢。
最新回答
- 2021-1-121 #
相关问题
- objective c:在iPhone上查找已安装应用的列表iphoneobjectivecios2021-01-11 06:27
- objective c:确定iPhone是否以编程方式被越狱iphoneobjectivecioscocoatouchjailbreak2021-01-10 05:58
- iphone:如何排序包含NSDictionaries的NSArray?iphoneobjectiveciosnsarraynsdictionary2021-01-10 21:25
- objective c:仅限某些iOS目标设备进行App Store提交iosobjectiveciphoneappstore2021-01-11 03:24
- objective c:如何从iPhone应用程序发送邮件而不显示MFMailComposeViewController?iphoneobjectiveciossendmailmfmailcomposeviewcontroller2021-01-10 20:28
看看创建自定义
MKAnnotationView
对象...基本上是个UIView
专为地图注解量身定制的 在该对象中,您可以拥有4个自定义标签。在你的飞天 类,您实现
MKMapViewDelegate
方法:这将在您有注释的地方显示您的自定义视图...如果您想逐步学习该教程,请观看此视频。
希望这会有所帮助
- (CustomMapAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { CustomMapAnnotationView *annotationView = nil; // determine the type of annotation, and produce the correct type of annotation view for it. CustomMapAnnotation* myAnnotation = (CustomMapAnnotation *)annotation; NSString* identifier = @"CustomMapAnnotation"; CustomMapAnnotationView *newAnnotationView = (CustomMapAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if(nil == newAnnotationView) { newAnnotationView = [[[CustomMapAnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:identifier] autorelease]; } annotationView = newAnnotationView; [annotationView setEnabled:YES]; [annotationView setCanShowCallout:YES]; return annotationView; }
我实际上刚刚在Apple开发人员站点上找到了一个新的Maps示例...具有所需的所有源代码.他们还使用自定义的 EDIT 叫做
MKAnnotationView
WeatherAnnotationView