如何在sos sdk中将svg图像设置为按钮图像?

时间:2012-03-22 09:33:32

标签: ios image svg

我想将svg(可缩放矢量图形)图像设置为ipad.so中的按钮图像,我可以将相同的图像用于ipad2,ipad3

2 个答案:

答案 0 :(得分:1)

您必须使用third party个库。 Quartz不了解SVG。

答案 1 :(得分:0)

您也可以使用https://github.com/arielelkin/PocketSVG

//Step 1
CGPathRef myPath = [PocketSVG pathFromSVGFileNamed:@"icon_convidar"];

//Step 2: To display it on screen, you can create a CAShapeLayer
//and set myPath as its path property:
CAShapeLayer *shape = [CAShapeLayer layer];
shape.path = myPath;


//Step 3: Fiddle with it using CAShapeLayer's properties:
shape.strokeColor = [UIColor redColor].CGColor;
shape.lineWidth = 4;

//Step 4: Display it!
[self.btnConvidar.layer addSublayer:shape];