在我的绘图应用程序中,我使用 UIImage 来缓存绘图。
以下代码行导致内存问题:
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0);
self.cacheImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
如何在不导致内存泄漏的情况下使用 UIGraphicsGetImageFromCurrentImageContext
?
任何帮助将不胜感激。提前致谢。
最佳答案
使用这个可能对你有帮助。 它对我的情况有帮助
@autoreleasepool {
// Write your code here
}
关于ios - 使用 UIGraphicsGetImageFromCurrentImageContext 时如何修复因内存问题而终止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45343546/