Draw text and add to a UIImage iOS 5/6

前端 未结 3 826
遇见更好的自我
遇见更好的自我 2020-12-16 05:57

I have a textbox, where i want the written text to be added to a UIImage.

How can i draw NSString to a UIImage?

I´ve searched, and found lots of examples, bu

3条回答
  •  生来不讨喜
    2020-12-16 06:47

    Emm, here is some thoughts. I think that one simple way is like this :

    1. Put aUIImageView on aView;
    2. Add aUITextView on aView;
    3. Get ScreenShot from aView;

    This may works fine.

    Also, this may come with a problem that screenshot may be not clear. Then, After step1 and step2, we may get new image by UIGraphics. (With here, we already know position where text should be on image and this should be ok.)

    PS: Some image may not have some attribution like CGImage and CGImage is needed for this. So, transform it.

提交回复
热议问题