Accessing enumerated variable causes MKPolyline subclass to not render

254 views Asked by At

Alright, having an odd problem, my polyline that is set as an overlay for my map shows up fine unless I try to access an enumerated variable in the rendererForOverlay method.

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
if ([overlay isKindOfClass:[MKGeodesicPolyline class]]) //If I change MKGeodesicPolyline to my subclass it won't render the overlay.
{
    CustomLine *poly = (CustomLine *)overlay;

    MKPolylineRenderer *renderer = [[MKPolylineRenderer alloc] initWithPolyline:(CustomLine *)overlay];


    //[poly testFunction]; //This will also cause overlay to not show

    //If I uncomment this it will cause the overlay to not show
    /*
    if (*poly.linecheck == Clear)
    {
        NSLog(@"Overlay should be red");
        renderer.strokeColor = [NSColor greenColor];
    }
    if (*poly.linecheck == Bad)
    {
        NSLog(@"Overlay should be green");
        renderer.strokeColor = [NSColor redColor];
    }
    */
    renderer.strokeColor = [NSColor redColor];
    //NSLog(@"polyline.linecheck %u",*poly.linecheck); //if this is uncommented it will also break the overlay.
    renderer.lineWidth = 3.0;
    return renderer;
}

return nil;

Here is my custom polyline's header.

#import <MapKit/MapKit.h>

enum linecheck
{
    Clear,
    Bad
};

@interface CustomLine : MKGeodesicPolyline
{

}

@property (readwrite) enum linecheck *linecheck;
0

There are 0 answers