Q:

Can I get a gif out of a custom MKAnnotationView?

I need to get gifs with different colors from this library: https://github.com/samvermette/SVPulsingAnnotationView
In the library I have access to the layer of the MKAnnotationView. But I need an animated gif of the generated annotation to use in a non-iOS project.

A:

I used renderInContext to create pngs from the CALayer (result). Then I created the gifs using python.
UIGraphicsBeginImageContextWithOptions(result.bounds.size, result.opaque, 0.0);
[result renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSString *pngFilePath = [NSString stringWithFormat:@"%@/blue dot.png",docDir];
NSData *data1 = [NSData dataWithData:UIImagePNGRepresentation(image)];
[data1 writeToFile:pngFilePath atomically:YES];

