Add Text to the Image

后端 未结 1 1725
攒了一身酷
攒了一身酷 2021-01-01 06:13

HI

Im currently developing an application where i have to add the text over the image at any position in the image(not subview) and the output should be the single i

相关标签:
1条回答
  • 2021-01-01 07:10
    UIImage *myImage = loadUnwatermarkedImage();
    NSString *myWatermarkText = @"Watermark";
    UIImage *watermarkedImage = nil;
    
    UIGraphicsBeginImageContext(myImage.size);
    [myImage drawAtPoint: CGPointZero];
    [myWatermarkText drawAtPoint: CGPointMake(10, 10) withFont: [UIFont systemFontOfSize: 12]];
    watermarkedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    

    Upon completion the watermarkedImage will be an autoreleased watermarked image. loadUnwatermarkedImage() is a fictional function providing an original image.

    0 讨论(0)
提交回复
热议问题