Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

RMPolygonAnnotation loses its layer properties after a while #639

Open
maciekish opened this issue May 28, 2015 · 2 comments
Open

RMPolygonAnnotation loses its layer properties after a while #639

maciekish opened this issue May 28, 2015 · 2 comments

Comments

@maciekish
Copy link

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

@appximus
Copy link

I'm having this problem too.

@appximus
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants