iOS:加载MKMapView并添加注释/叠加层时的通知? [英] iOS: Notification when MKMapView is loaded and annotations/overlays are added?
问题描述
我知道用于在加载地图并添加注释和叠加层时告知我的委托方法。 ( mapViewDidFinishLoadingMap:
mapView:didAddAnnotationViews:
mapView:didAddOverlayViews:
)
I am aware of the delegate methods used to let me know when the map has loaded and annotations and overlays have been added. (mapViewDidFinishLoadingMap:
mapView:didAddAnnotationViews:
mapView:didAddOverlayViews:
)
我想从我的 MKMapView $ c $创建一个
UIImage
c>一旦所有东西都装满了。目前我创建 UIImage
一旦 mapView:didAddOverlayViews:
被调用,但这并不总是可靠的,因为有时候叠加需要更长的时间来添加,有时 mapViewDidFinishLoadingMap:
被多次调用或加载需要很长时间。有时它不会被调用,因为瓷砖是缓存的。因此,很难确切知道什么时候加载了。我尝试过使用计时器,但这也不能让它变得可靠。
I am wanting to create a UIImage
from my MKMapView
once everything has loaded. Currently I am creating my UIImage
once mapView:didAddOverlayViews:
is called, but this is not always reliable, because sometimes the overlay take longer to be added, sometimes mapViewDidFinishLoadingMap:
is called more than once or it takes a long time to load. Sometimes it is NOT called because tiles are cached. So, it is very hard to know exactly when everything has loaded. I have tried using a timer but that doesn't make it reliable either.
我的问题是,我怎么知道什么时候已经完全加载,包括所有地图图块,所有注释和所有叠加层?
推荐答案
这是一个老问题,但如果您使用的是iOS 7只需使用mapView mapViewDidFinishRenderingMap委托。
It's an old question, but if you're using iOS 7 just use the mapView mapViewDidFinishRenderingMap delegate.
- (void)mapViewDidFinishRenderingMap:(MKMapView *)mapView fullyRendered:(BOOL)fullyRendered
{
// Image creation code here
}
这篇关于iOS:加载MKMapView并添加注释/叠加层时的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!