view 转为image 清晰度不变
2016-01-26 14:21
309 查看
-(UIImage *)getImageFromView:(UIView *)theView
{
//scale 为2可以改为2倍图的清晰度,plus可以改为3,
float scale = 2;
UIGraphicsBeginImageContextWithOptions(theView.bounds.size,
YES, scale);
[theView.layer
renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
{
//scale 为2可以改为2倍图的清晰度,plus可以改为3,
float scale = 2;
UIGraphicsBeginImageContextWithOptions(theView.bounds.size,
YES, scale);
[theView.layer
renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
相关文章推荐
- IOS高级教程1:处理1000张图片的内存优化
- 获取UIImage中的图像数据
- CALayer与UIView的关系
- UIView的bounds和frame区别
- UIImage的一个实例函数stretchableImageWithLeftCapWidth
- uiview
- uiview生命周期
- UIView翻译 (参考)
- iOS 转变UIView到UIImage
- UIView动画
- initWithFrame 和 initWithCoder
- [CS193P] 第六堂課摘要及心得筆記
- 【无线互联】基于ios系统的图片(滤镜)编辑
- UI第一天
- 棋盘
- ios实现button变换颜色并可以放大、缩小、旋转
- UIImageView的使用
- iOS实现头像选取(照相或者图片库)、大小等比缩放、生成圆形头像
- uiview contentViewmode
- iphone开发小记 基础知识2