0

I make ios7 apps.

And this app can capture. but it's white noise in addsubview images.
Please help me.

iOS6 and iOS5 is Not has white noise.

This is my code.

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 ());

I use alpha png image in UIimage. And addSubview on view.

white noise imase here

4

2 回答 2

1

iOS 7 有不同的截屏方式

UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale);
[self drawViewHierarchyInRect:self.frame afterScreenUpdates:NO];    
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
于 2013-11-01T21:18:47.680 回答
0

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

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

于 2013-11-17T21:46:59.533 回答