iOS 10 MapKit previous layer zoom issue

2020-05-23 18:03发布

I am working in a map application which renders a polyline over a map. I am having an issue when zooming, it keeps the previous polyline on the tile.

I have tried to force redrawing:

[self.mapView reloadInputViews];
[self.mapView.layer setNeedsDisplay];
[self.mapView setNeedsDisplay];

Also I tried to slow the zoom speed, but the issue is still in there:

[MKMapView animateWithDuration:2
                         delay:0
        usingSpringWithDamping:0.6
         initialSpringVelocity:10
                       options:UIViewAnimationOptionCurveEaseOut
                    animations:^{
                        [self.mapView setVisibleMapRect:unionRectThatFits
                                            edgePadding:UIEdgeInsetsMake(20, 10, 20, 10)
                                               animated:YES];
                    }
                    completion: nil];

Does anyone know about this?

enter image description here

1条回答
狗以群分
2楼-- · 2020-05-23 18:42

I found the resolution to the problem here: How to refresh an MKOverlayRenderer when mapView change

So I added:

override var boundingMapRect: MKMapRect {

    return MKMapRectWorld
}

To my MKPolyline & MKCircle subclass.

查看更多
登录 后发表回答