我正在从 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!