Iphone iOS7屏幕捕获有白噪声
我制作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
而这个应用程序可以捕获。但在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