隐藏注释副标题,或更改颜色
在我的应用程序中,我将字幕添加到注释图钉,但不想与图钉一起显示。我只是将它用于编码目的。如何隐藏或更改字幕颜色?
In my app am adding subtitle to annotation pin but don't want to show with pin. I am just using it for coding purpose. How can I hide or change subtitle color?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解您的问题,您正在使用 pin 字幕进行某些处理,并且不想在 pin 上显示它。如果您使用默认标注,则在分配
annotation.subtitle = @"some subtitle"
后,将无法更改字幕的颜色或隐藏它。我建议,在注释中添加另一个变量,并将字幕分配给该变量(
annotation.newSubtitle = @"some subtitle"
),并且不要为 subtitle 属性分配任何内容。您想要执行的所有处理都可以使用annotation.newSubtitle
完成。如果您不愿意向注释添加新变量,那么您将不得不实现自定义标注,这很乏味。
编辑:
您会发现以下内容对于将 NSString 分配给您的注释很有用。
在实现部分
并用于分配
访问
If I understand your question correctly, you are using pin subtitle for some processing and doesn't want to show it on pin. If you are using default callout then it is not possible to change colour of subtitle or to hid it once you assign
annotation.subtitle = @"some subtitle"
.I would suggest, add another variable to annotation and assign subtitle to that variable (
annotation.newSubtitle = @"some subtitle"
)and don't assign anything for subtitle attribute. All the processing you want to do then can be done withannotation.newSubtitle
.If you are reluctant to add new variable to annotation then you will have to implement custom callout which is tedious.
EDIT:
You will find following useful to assign NSString to your annotation.
In implementation part
And for assigning
for accessing
如果您想访问每个特定注释的任何字符串,您可以使用 NSMutableDictionary 并将注释添加为键。稍后你可以访问它
If you want access any string for every specific annotation, you can use NSMutableDictionary and add your annotation as key. and later you could access this in