I am trying to display a lot of MKCircles
using the MapKit. So far I have extended MKCircle <MKOverlay>
in a class called Circle. I have a property that is readonly called circleView. In the getter I construct the MKCircleView
.
-(MKCircleView *)circleView {
if(!_circleView){
_circleView = [[MKCircleView alloc] initWithOverlay:self];
[_circleView setFillColor:self.color];
}
return _circleView;
}
Then, in the map, I do:
- (MKOverlayView *)mapView:(MKMapView *)mapView
viewForOverlay:(id<MKOverlay>)overlay {
if ([overlay isKindOfClass:Circle.class]) {
Circle *region = overlay;
return [region circleView];
}
return nil;
}
I am loading those circles from a server, however I can have several circles (more than 1k displaying in a region).
I feel like the UI isn't responsive enough. Even with Circles in cache from the server it takes a while to redraw them and moving around the region can be painful. Is there any way to improve this performance?
EDIT
I have discovered that I was displaying more circles that necessary but still it is slow as hell.