我想截取UIImageView和UILabel的截图。UILabel的屏幕截图和UIImageView中的内容
我到目前为止已经抓住了ImageView中的UIImage,然后渲染了叠加层,但是UILabel的定位都是错误的。我将捕捉的大小设置为实际图像大小(这不是我想要的)。
我只是想能够截图如何在屏幕上显示它。
CGSize imageSize = self.imageFromOtherView.size;
// define the size and grab a UIImage from it
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
[self.imageFromOtherView drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)];
[self.socialLabel.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
您是否希望获得整个窗口或屏幕上图像的截图?你的问题有点难以分辨。 – fsb