簡體   English   中英

iOS7屏幕截圖有白噪聲

[英]iOS7 screen capture has white noise

我制作ios7應用。

而且此應用程序可以捕獲。 但是在addsubview圖片中是白噪聲。
請幫我。

iOS6和iOS5不具有白噪聲。

這是我的代碼。

CGRect rect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextFillRect(ctx, rect);
[self.view.layer renderInContext:ctx];
NSdate pngData = UIImagePNGRepresentation (UIGraphicsGetImageFromCurrentImageContext ());

我在UIimage中使用alpha png圖像。 並在視圖上添加subview。

這里有白噪聲干擾

iOS 7具有截屏的不同方式

UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale);
[self drawViewHierarchyInRect:self.frame afterScreenUpdates:NO];    
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

您正在使用CGContextFillRect用什么填充矩形? 您似乎尚未定義填充顏色或圖案。 盡管iOS7具有如上一個答案中所述的新方法,但是如果編碼正確,則先前的方法應該仍然可以使用。

我的猜測是,在以前的OS中,填充顏色默認為0,或者您已經在其中正確編碼了,在iOS7中,它必須使用內存中的任何東西或其他東西。 嘗試在CGContextSetFillColorWithColor之前調用CGContextFillRect

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM