有没有办法对用于 MKUserLocation 蓝点的 MKAnnotationView 进行子类化?
我通过子类化 MKAnnotationView 创建了一个自定义注释视图。此类还创建一个自定义标注(信息弹出“气泡”)视图,该视图的外观与我的应用程序相匹配。
我还希望能够重新设计用户位置点的标注气泡,但似乎我对该视图的唯一控制是它是否被完全覆盖,通过在mapView中使用以下内容: viewForAnnotation: 方法:
if(annotation == self.mapView.userLocation)
{
return nil;
}
但我真正想做的是找出 MapKit 对用户位置蓝点使用的注释视图,然后将其子类化,以便我可以为其标注气泡添加外观...或者还有其他方法吗?还是根本就没有办法?
I've created a custom annotation view by subclassing MKAnnotationView. This class also creates a custom callout (info pop-up 'bubble') view which is skinned to match my app.
I also want to be able to reskin the callout bubble for the user location dot, but it seems as though the only control I have over that view is whether it is overridden completely or not, by using the following inside the mapView:viewForAnnotation:
method:
if(annotation == self.mapView.userLocation)
{
return nil;
}
But what I really want to do is find out what annotation view MapKit is using for the user location blue dot, and then subclass it so I can skin its callout bubble... Or is there another way? Or just no way at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定这会对您有帮助,但您可以使用默认的用户位置注释视图,然后窃取
mapView:didSelectAnnotationView:
中的视图:我已经使用此技巧来更改标注标题和副标题,并使用
leftCalloutAccessoryView
添加图像。但是,我还没有尝试完全替换标注,所以我不知道这是否可能。I am not sure this will help you, but you can use the default user location annotation view, then steal the view in
mapView:didSelectAnnotationView:
:I have used this trick to change the callout title and subtitle, and add an image using
leftCalloutAccessoryView
. However, I haven't tried totally replacing the callout, so I don't know if it's possible.您可以使用
You can use
我认为直接不可能,但您可以在运行时重写一些方法: http://theocacao. com/document.page/266
I think it is not possible directly, but you can override some methods in runtime with this: http://theocacao.com/document.page/266