本文介绍了如何将 UIView 转换为 UIImage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我正在从 currentview 截取屏幕截图.但我想设置框架……不想将全视图转换为图像.我给出了框架大小……但它总是需要图片为全视图..有什么帮助吗?
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!