how to use SVGKImage change SVG fill color?
SVGKImage *svgImage = [SVGKImage imageNamed:@"card.svg"];
svgImage.size = self.bounds.size;
SVGKLayeredImageView *imageLayer = [[SVGKLayeredImageView alloc] initWithSVGKImage:svgImage];
SVGKLayer *layer = (SVGKLayer *)imageLayer.layer;
self.layer.mask = layer;
Here, I find a easy way to get the CAShapeLayer
SVGKImage *svgImage = [SVGKImage imageNamed:@"test.svg"]; CAShapeLayer *thisLayer = svgImage.CALayerTree; //thisLayer has the UIBezierPath info in test.svg,so,you can do anything with it.
You have to use the
CALayer
sub-layers to changing the color :Hope this helps.
Source : https://github.com/SVGKit/SVGKit/issues/98