您的位置:首页 > 产品设计 > UI/UE

iOS 转变UIView到UIImage

2014-05-23 14:08 573 查看
- (UIImage*) imageWithUIView:(UIView*) view{ // 创建一个bitmap的context
// 并把它设置成为当前正在使用的context
UIGraphicsBeginImageContext(view.bounds.size);
CGContextRef currnetContext = UIGraphicsGetCurrentContext();
[view.layer renderInContext:currnetContext];
// 从当前context中创建一个改变大小后的图片
UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
// 使当前的context出堆栈
UIGraphicsEndImageContext();
return image;

}

原文地址:http://my.oschina.net/sunqichao/blog/145205
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  图片 iOS UIView