当我使用以下代码获取视图快照时,当我导航到视图并返回上一个视图时,它会一次又一次地分配 12MB 内存。
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
在使用仪器进行分析时,我知道 CGRaster Data 对此负责?如何解决这个问题?