如图在图片上添加水印 大体流程就是自己获取一个上下文将图片和文字和图片绘制到上下文当中;然后生成一张新的图片
//需要添加水印的图片
UIImage *image = [UIImage imageNamed:@"阿狸头像"];
//1.开启一个跟图片原始大小的上下文
UIGraphicsBeginImageContextWithOptions(image.size, NO, 0);
//2.将图片绘制到上下文当中
[image drawAtPoint:CGPointZero];
//3.将文字绘制到上下文当中
NSString *str = @"版权所有";
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
dic[NSFontAttributeName] = [UIFont systemFontOfSize:18];
dic[NSForegroundColorAttributeName] = [UIColor blueColor];
[str drawAtPoint:CGPointMake(image.size.width - 75, image.size.height - 20) withAttributes:dic];
//4.从上下文当中生成一张图片
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
//5.关闭山下文
UIGraphicsEndImageContext();
self.imageView.image = newImage;