iosdevnyc
iosdevnyc

Reputation: 1871

Dynamic create a png image on iOS

How do I create a png image from text in iOS?

Upvotes: 0

Views: 587

Answers (2)

Corey Floyd
Corey Floyd

Reputation: 25969

How to save a view as an image:

UIGraphicsBeginImageContext(myView.bounds.size);
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Upvotes: 1

Jeff Kelley
Jeff Kelley

Reputation: 19071

It's covered in one of the first lectures in this term of Stanford's free iPhone programming course. There's a video and PDF notes.

Basically, you can create a UIImage and use its graphics context to draw into it, then save a PNG representation of the image.

Upvotes: 1

Related Questions