iOS 图片加文字水印

- (UIImage *) addText:(UIImage *)img text:(NSString *)mark {

    

    int w = img.size.width;

    int h = img.size.height;

    

    UIGraphicsBeginImageContext(img.size);

    

    [[UIColor redColor] set];

    [img drawInRect:CGRectMake(0, 0, w, h)];

    

    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:20],

                          NSForegroundColorAttributeName:[UIColor redColor]};

    

    CGFloat pointX = w - 200;

    CGFloat pointY = h - 100;

    

    [mark drawInRect:CGRectMake(pointX  , pointY, 150, 100) withAttributes:dic];

    UIImage *aimg = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return aimg;

}

原文地址:https://www.cnblogs.com/poky/p/5329039.html