您的位置:首页 > 产品设计 > 产品经理

【iPhone Development】对图片加入特定水印的方法

2011-08-01 18:07 441 查看
对图片加入特定水印的方法

iphone拍照后会有一些信息需要显示在图片上,上传或是打印,就是所谓的水印那样,可以通过下面的代码实现:

//image是你要增加水印的底图
UIGraphicsBeginImageContext(image.size);
CGContextRef context = UIGraphicsGetCurrentContext();
//设置水印颜色
[[UIColor whiteColor] set];
[title drawInRect:CGRectMake((image.size.width-[title sizeWithFont:font].width)/2+8, -30+(30-[title sizeWithFont:font].height)/2, 100, 30) withFont:font];

//获得加好水印的图片
result = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: