我想在引脚位置上方显示UIView,如果用户在地图上移动,UIView应保持在引脚位置上方。我不想使用标注泡泡。有没有其他方法?如何在MKpointAnnotation Pin上方显示UIView
0
A
回答
1
iOS中9,我们有一个名为detailCalloutAccessoryView
您可以创建一个视图,并设置为
annotationView.detailCalloutAccessoryView = tempView
新的属性,请检查网络连接,以获得更多的细节
0
尝试使用此代码:
func mapView(_ mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView {
if (annotation is MKUserLocation) {
return nil
}
else if (annotation is YourAnnotationClassHere) {
let identifier = "MyCustomAnnotation"
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)
if annotationView {
annotationView.annotation = annotation
}
else {
annotationView = MKAnnotationView(annotation, reuseIdentifier: identifier)
}
annotationView.canShowCallout = false
// set to YES if using customized rendition of standard callout; set to NO if creating your own callout from scratch
annotationView.image = UIImage(named: "your-image-here.png")!
return annotationView
}
return nil
}
这主要是你需要的工作。这是这个答案的一个迅速版本在这里:How to create Custom MKAnnotationView and custom annotation title and subtitle
希望它帮助!
+0
既然你还没有发布任何你的代码,这是我可以帮助你的唯一方法 –
相关问题
- 1. 如何在mapview中显示pin注释?
- 2. 如何以编程方式在UIView上显示图片?
- 3. 在Mac上显示UIView
- 4. 如何在地图上显示pin对于iphone
- 5. 如何在地图上自动显示标题/副标题(pin)
- 6. UIView UITableView上方没有显示 - iOS
- 7. 如何显示UIView上的名称?
- 8. 为什么第二个MKPointAnnotation不显示?
- 9. MKPointAnnotation - 默认显示标题和动画?
- 10. 如何在UIView中显示UIToolbar
- 11. 获取MKPointAnnotation标题
- 12. 在uiview上的显示控件
- 13. 在UIViewController上显示自定义UIView
- 14. 如何以编程方式在UIScrollView中显示UIView?
- 15. RNBlurModalView显示UIView
- 16. 如何在横向上显示一个UIView?
- 17. 如何在UIView上显示实时,时间 - Swift
- 18. 如何在iPhone上的单个UIView显示大量的控制
- 19. 如何在UIView上显示2D char数组。 iOS
- 20. 如何在显示字符数量的输入PIN上提供点?
- 21. 如何显示Pin的标签(在地图上),而不点击它Xamarin.Forms pcl
- 22. 如何在UITabBar上方滑动UIView
- 23. iPhone SDK:在相机显示屏上显示UIView
- 24. 如何在pin上添加标题?
- 25. UIView显示错误的方向
- 26. 的UIView显示在屏幕
- 27. 在UIView中显示UIButtons
- 28. 是否显示UIView?
- 29. Pin It按钮不显示计数
- 30. iOS如何显示新的UIView?
可能会帮助你http://stackoverflow.com/a/38741017/6433023 –