0
我正在嘗試使用以下代碼將已編輯的UIscrollView保存到UIImage中。但我所看到的並不是我所保存的。在保存的照片旁邊,用某個空白的灰色條來抵消它。我的UIScrollView沒有觸及視圖的框架。任何人有想法如何去?如果我必須使用「theScrollView.layer」來渲染它。放大照片後,照片會變得最差。將UIscrollView保存爲Uiimage
CGSize photoSize = theScrollView.bounds.size;
UIGraphicsBeginImageContext(photoSize);
CGContextRef context = UIGraphicsGetCurrentContext();
CALayer *layer = self.view.layer;
[layer renderInContext:context];
UIImage *someImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(someImage,nil, nil, nil);