2012-03-22 176 views
1

我想在ipad.so中设置svg(可缩放矢量图形)图像作为按钮图像,以便我可以对ipad2使用相同的图像,ipad3如何将ios sdk中的svg图像设置为按钮图像?

+0

user1285498:请使用此问题,因为你重复的问题应该在适当的时候被关闭。根据我对你的其他问题的评论,你能在这里告诉我们你在网上尝试过回答这个问题吗?你检查过官方的iOS文档吗? – halfer 2012-03-22 15:35:50

回答

1

您必须使用third party库。 Quartz不知道SVG。

+0

是梯度是在这个包的目标svg – user1285498 2012-03-26 05:00:12

+0

没有。在[GitHub]上尝试其他方法(https://github.com/search?utf8=&&====&&=svg&repo=&langOverride=&start_value=1&type=Everything&language=Objective-C) – jacekmigacz 2012-03-26 06:30:51

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];