I want to make some UIImage with label, which will show, if photo isn't loaded. Generation of this image in application is more useful, because it very easy to localize text. I have code:
NSString *text = @"Photo not loaded yet. Please wait.";
UIFont *font = [UIFont boldSystemFontOfSize:35];
CGSize imageSize = CGSizeMake(400, 400);
CGSize constraint = CGSizeMake(imageSize.width * 0.8f, imageSize.height * 0.8f);
CGSize textSize = [text sizeWithFont:font constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0);
CGPoint pointToDraw = CGPointMake((imageSize.width - textSize.width) / 2, (imageSize.height - textSize.height) / 2);
[text drawAtPoint:pointToDraw forWidth:textSize.width withFont:font lineBreakMode:NSLineBreakByWordWrapping];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
But it draw only first line, like in screenshot.
Where I was wrong?
Thank you.