0

我的应用程序截取了我的视图。该代码有效,但配置文件/分配工具显示内存未释放上下文。这是一些关于此的代码:

CGRect rect = CGRectMake(0,0, self.view.frame.size.width, self.view.frame.size.height);
UIGraphicsBeginImageContext(rect.size);

CGContextRef context = UIGraphicsGetCurrentContext();

[self.view.layer renderInContext:context];   //allocations tool shows 49.6% alert here!


UIImage *wallpaper = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

我尝试使用 autorelease{} 但没有任何效果......所以我的应用程序内存使用量在这个操作之后越来越高,我不知道如何释放这个上下文。我正在使用ARC。

4

0 回答 0