user1285498
user1285498

Reputation: 39

How can i set svg images as button images in ios sdk?

I want to set svg(scalable vector graphics) images as button images in ipad.so that i can use same image for ipad2,ipad3

Upvotes: 1

Views: 2335

Answers (2)

Mohshin Shah
Mohshin Shah

Reputation: 298

You can also use 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];

Upvotes: 0

jacekmigacz
jacekmigacz

Reputation: 789

You have to use third party libraries. Quartz is not aware of SVG.

Upvotes: 1

Related Questions