DEPRECATED-mapbox-ios-sdk
DEPRECATED-mapbox-ios-sdk copied to clipboard
RMPolygonAnnotation loses its layer properties after a while
We have 100-200 subclassed RMPolygonAnnotations
on our map. These have a couple properties set on the layer when they are instantiated:
- (void)setSelected:(BOOL)selected
{
self.lineColor = (selected ? UIColor.orangeColor : UIColor.hittaRealestateBabyBlueColor);
self.fillColor = [UIColor.hittaBlue colorWithAlphaComponent:0.5];
self.lineWidth = (selected ? 3.0 : 0.5);
self.layer.masksToBounds = (selected ? NO : YES);
self.layer.allowsEdgeAntialiasing = NO;
self.layer.allowsGroupOpacity = NO;
self.layer.shouldRasterize = YES;
self.layer.rasterizationScale = UIScreen.mainScreen.scale;
self.layer.canShowCallout = self.realestateBoundary.blockUnit.length > 0;
self.layer.calloutOffset = CGPointMake(0, 10);
}
Quite often when moving the map around some annotations seem to lose their RMShape layer properties and get a black outline instead of the one i have set. This also happens every time when changing visible tile sets on the map. Layer gets released and recreated or something and the properties get lost perhaps?
Example: http://s.swic.name/bBMp
I'm having this problem too.
The way i work around it is i create subclass for RMPolylineAnnotation, RMPolygonAnnotation and RMCircleAnnotation.
They both implemented a function called -(BOOL)isAXAnnotation; Then modify RMMapView.m : 3024, 3080 so that annotation.layer doesn't get released. (the line between willHideLayerForAnnotation and didHideLayerForAnnotation.
if ([annotation respondsToSelector:@selector(isAXAnnotation)]) {
} else {
annotation.layer = nil;
}
The only problem is that it could cause a high memory usage for every annotation.layer you have.