简体   繁体   English

iOS MKMapViewDelegate-第二次获取UserLocation

[英]iOS MKMapViewDelegate - Getting UserLocation the second time

I create a MKMapView and associate a MKMapViewDelegate with it. 我创建一个MKMapView并将MKMapViewDelegate与其关联。

The MKMapViewDelegate gets notified correctly that DidUpdateUserLocation and other life cycle events occurred. 正确通知MKMapViewDelegate发生了DidUpdateUserLocation和其他生命周期事件。

When I create another MKMapView later on in the app, the MKMapViewDelegate doesn't receive any notifications about MapLoaded or the like. 当我稍后在应用程序中创建另一个MKMapView时,MKMapViewDelegate不会收到有关MapLoaded之类的任何通知。 Just the constructor is fired. 只是构造函数被解雇了。

How do I get a new map instance the 2nd time to update the MKMapViewDelegate with lifecycle events? 如何第二次获取新的地图实例,以使用生命周期事件更新MKMapViewDelegate?

Using .NET for iPhones (MonoTouch) 在iPhone上使用.NET(MonoTouch)

In the Map Delegate handle this event ONCE only, it gets fired a lot. 在“地图代表”仅一次处理此事件的情况下,它会被触发很多。 This way you never need to worry about how the map caches. 这样,您就不必担心地图如何缓存。

    public override void RegionChanged (MKMapView mapView, bool animated)
    {
        if (!hasSetupMapBoolean)
        {
            localCopymap = mapView;
            DoYourSetupMap ();
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM