How to draw multiple line text to uiimageview iphone?
- by Hu?nh Phong
I have UITextView for text, after user press DONE, I convert text to UIImageView and show it. It works with one line of text very good,
and Screenshot 1
. But if user types two lines, or more: the result is still one line??? Screenshot 2
I want to display two or more lines in UIimageView
Can anybody help me! Thank you very much!
Here is my code:
-(UIImage *)convertTextToImage : (ObjectText *) objT;
{
UIGraphicsBeginImageContext(CGSizeMake(([objT.content sizeWithFont:objT.font].width+10), ([objT.content sizeWithFont:objT.font].height+10)));
[[objT getcolor] set];
[objT.content drawAtPoint:CGPointMake(5, 5) withFont:objT.font];
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return result;
}