Reputation: 87
I need to play different animated SVG files in a UIView. For example, like this.
Is it possible, and can anybody tell me how to do it?
Update
With PocketSVG I'm trying this (Thanks @Dhanashree):
- (void)viewDidLoad
{
[super viewDidLoad];
CGPathRef myPath = [PocketSVG pathFromSVGFileAtURL:[NSURL URLWithString:@"http://www.hypnobeast.com/spirals/Hypno_Beast_Spiral_1000x1000.svg"]];
CAShapeLayer *myShapeLayer = [CAShapeLayer layer];
myShapeLayer.path = myPath;
[self.view.layer addSublayer:myShapeLayer];
}
But it doesn't work. The animated part of the SVG doesn't appear.
Upvotes: 4
Views: 4335
Reputation: 79
PocketSVG will allow you to display and manipulate the lines of an SVG file.
PocketSVG *myBezier = [[PocketSVG alloc] initFromSVGFileNamed:@"BezierCurve1-iPad"];
UIBezierPath *myPath = myBezier.bezier;
CAShapeLayer *myShapeLayer = [CAShapeLayer layer];
myShapeLayer.path = myPath.CGPath;
[self.view.layer addSublayer:myShapeLayer];
Upvotes: 1