开发者

mapViewWillStartLoadingMap not called

开发者 https://www.devze.com 2023-03-10 01:41 出处:网络
Hey guys Im trying to show the activity indicator when the map is loading. - (void)mapViewWillStartLoadingMap:(MKMapView *)mapView

Hey guys Im trying to show the activity indicator when the map is loading.

- (void)mapViewWillStartLoadingMap:(MKMapView *)mapView
{
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
    NSLog(@"map started loading);
}

I tried using abov开发者_StackOverflow社区e method, but it never gets called. Whenever i zoom in or out the map tiles will start loading, however this method is not called.


Just declaring that your class implements the protocol is not enough. That just helps the compiler generate warnings or errors about missing or incorrect method implementations.

You have to actually set the delegate property of the map view to that class instance.

If the map view has been created in IB then right-click on the map view and connect the delegate property to File's Owner.

If the map view is created in code, then in viewDidLoad, add a line like:

mapView.delegate = self;

If you've done all this and the method still isn't getting called, it's also possible that the regions your are viewing are already cached locally and don't need re-loading. Try moving to a region or zooming in deep somewhere you've never been.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号