图片上添加文字
2015-08-04 15:26
225 查看
Objective-C
- (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)];
[mark drawInRect:CGRectMake(10, 55, 130, 80) withFont:[UIFont systemFontOfSize:18]];
UIImage *aimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return aimg;
}
- (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)];
[mark drawInRect:CGRectMake(10, 55, 130, 80) withFont:[UIFont systemFontOfSize:18]];
UIImage *aimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return aimg;
}
相关文章推荐
- 单buffer,双buffer和三buffer的区别
- 博客免责声明
- iOS 中KVC、KVO、NSNotification、delegate 总结及区别
- Android 基础 笔记
- BootStrap 管理系统框架选择
- XCode6.3编写swift+OC引入含C++的库时的问题
- 让页面底部固定
- hdu1754 单点更新
- leetcode Factorial Trailing Zeroes非负整数阶乘后尾0个数
- WordPress主题 Music Pro 高级音乐/电台自适应主题[更新至v1.0]
- android studio 工具
- 极光推送Jpush功能(具体参照官网说明文档,注意此文红色字体)
- python 多线程处理List
- dSploitzANTI渗透教程之修改MAC地址与Wifi监听器
- 开发的某条delete报错
- 9.3栈和队列(四)——堆盘子
- hdu1556 线段树更新区间
- ArcSDE10.2 for Oracle 11g 安装和创建企业数据库
- leetcode——Count Primes
- canvas 绘图基础