我的项目中有AVFoundation框架,我正在使用previewLayer可见的屏幕截图。当我拍摄屏幕时,图像看起来有点拉伸。如何解决拉伸问题?
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
UIGraphicsPushContext(context);
[image drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)];
UIGraphicsPopContext();
[self renderView:self.overlayLabel inContext:context];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
self.screenshotImage = screenshot;
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(screenshot, self, nil, nil);