引脚移动后MKMapView刷新 [英] MKMapView refresh after pin moves
本文介绍了引脚移动后MKMapView刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用新坐标更新自定义AnnotationView。但问题是它只能在用MKMapView进行一些操作之后进行视觉更新,例如:缩放或移动。
如何手动更新地图上的视觉位置?
A custom AnnotationView is updated with new coordinates. But the problem is that it visually updates only after some manipulations with MKMapView, e.g. zooming or moving. What should I do to manually update visual position on a map?
PS。我试图将区域更改为当前地图的区域。但它确实改变了变焦。这很奇怪。
PS. I've tried to change region to current map's region. But it does change zoom. It's strange.
[mapView setRegion:[mapView region] animated:YES];
推荐答案
经过数小时的研究后,我有点兴奋。答案就是:
I am a little shoked after hours of research. The answer is just:
[mapView setCenterCoordinate:mapView.region.center animated:NO];
不要问我为什么,但它更新了mapview,这就是我需要的。
Do not ask me why, but it updates a mapview and it's what i was need.
这篇关于引脚移动后MKMapView刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文