Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS7屏幕捕获有白噪声_Iphone_Ios_Objective C_Ios7 - Fatal编程技术网

Iphone iOS7屏幕捕获有白噪声

Iphone iOS7屏幕捕获有白噪声,iphone,ios,objective-c,ios7,Iphone,Ios,Objective C,Ios7,我制作ios7应用程序。 而这个应用程序可以捕获。但在addsubview图像中是白噪声。 请帮帮我。 iOS6和iOS5没有白噪声。 这是我的密码 CGRect rect = [[UIScreen mainScreen] bounds]; UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextFillRect(c

我制作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图像。并在视图上添加子视图


iOS 7有一种不同的屏幕截图制作方法

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

您正在使用
CGContextFillRect
用什么填充矩形?您似乎没有定义填充颜色或图案。尽管iOS7有一个新方法,如前一个答案中所述,但如果编码正确,前一个方法仍然可以工作

我的猜测是,在以前的操作系统中,填充颜色默认为0,或者您在那里对其进行了正确编码,而在iOS7中,它必须使用内存中发生的任何东西。尝试在
CGContextFillRect
之前调用
CGContextSetFillColorWithColor