如何将UIView转换为UIImage? [英] How to convert UIView as UIImage?

查看:128
本文介绍了如何将UIView转换为UIImage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在拍摄来自currentview的屏幕截图。但是我想要设置框架...。不想将fullview转换为图像。我给了框架尺寸..但它总是需要
图像作为fullview ..任何帮助拜托?

I am taking screenshot image from currentview.but i want to set frame….don't want to convert fullview as image.I gave frame size..but it takes always Image as fullview..any help please?

            CGRect rectt = CGRectMake(100, 150,150,200);
    UIGraphicsBeginImageContext(rectt.size);
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:rectt];


推荐答案

quartz可以帮助你......看看从图像的一部分创建图像 ....
它不是你的问题的直接解决方案,但我认为你将能够调整它以满足你的需求..

quartz might help you... look at creating image from part of image.... its not a direct solution to your question, but i think you'll be able to tweak it to fit your needs..

这篇关于如何将UIView转换为UIImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆