c++ - Convert the contents of a UILabel to an image and save it to disk -


i have project need lot of individual words , phrases converted graphic format - preferably transparent png.

my thought load each word/phrase text file 1 @ time, put uilabel , grab contents of uilabel graphic , write png file. problem i'm not sure how graphic part.

ideally, uilabel resize right fit contents, don't end clipped words or lots of blank space.

can point me in right direction? don't objective-c i've got 25 years of c++.

thanks, lindsay

just add label on self.view , call method. method save image in photoalbum, , wil return image created, can use it. hope have searched for.

- (uiimage *)createimagewithlabel {     uigraphicsbeginimagecontextwithoptions(self.view.frame.size, self.view.opaque, 0);      [self.view.layer renderincontext:uigraphicsgetcurrentcontext()];      uiimage *image = uigraphicsgetimagefromcurrentimagecontext();     uiimagewritetosavedphotosalbum(image, nil, nil, nil);     uigraphicsendimagecontext(); //    _iv.image = image;     return image; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -