我想截取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