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();iPhone 应用程序开发
iOS程序员
//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();iPhone 应用程序开发
iOS程序员
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货