Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift MKAnnotationView图标下的标题_Swift_Mkannotationview - Fatal编程技术网

Swift MKAnnotationView图标下的标题

Swift MKAnnotationView图标下的标题,swift,mkannotationview,Swift,Mkannotationview,当使用mkmarkeranotationview进行注释时,标题显示在图标下方,如何在MKAnnotationView中执行此操作 例如: 标题显示在图标下方: annotationView = MKMarkerAnnotationView(annotation: nil, reuseIdentifier: identifier) annotationView = MKAnnotationView(annotation: nil, reuseIdentifier: identifier) 标

当使用
mkmarkeranotationview
进行注释时,标题显示在图标下方,如何在
MKAnnotationView
中执行此操作

例如:

标题显示在图标下方:

annotationView = MKMarkerAnnotationView(annotation: nil, reuseIdentifier: identifier)
annotationView = MKAnnotationView(annotation: nil, reuseIdentifier: identifier)
标题不显示在图标下:

annotationView = MKMarkerAnnotationView(annotation: nil, reuseIdentifier: identifier)
annotationView = MKAnnotationView(annotation: nil, reuseIdentifier: identifier)

MKAnnotationView
不会自动执行此操作。您必须自己完成这项工作(例如,有关ObjC示例,请参见)。仅供参考,
MKMarkerAnotationView
具有其他自定义行为(当您选择注释时,注释视图会放大,注释的副标题会被查看,等等),因此您必须确定要复制多少自定义行为。但是
MKAnnotationView
不会为您做任何事情:您必须自己编写所有代码。我只希望注释图像下有一个标题。另一个问题:是否可以在mkmarkeranotation中更改图像?您可以设置
mkmarkeranotationview
的格式。请参阅编辑我的代码。Im给出错误:“MKAnnotationView”类型的值没有成员“glyphImage”是的,您已将
annotationView
声明为
MKAnnotationView
,因此它不知道
mkMarkerNotationView
属性。将其更改为
mkmarkernotationview
(并强制转换
dequeueReusableAnnotationView
的结果)。