gpt4 book ai didi

调用 nil 后 iPhone 内存没有释放

转载 作者:行者123 更新时间:2023-12-03 21:18:25 24 4
gpt4 key购买 nike

我正在使用Apple的ScrollingSuite来显示带有许多大图像的大 ScrollView 。(768 x1024) ImageView 的图像由

设置
controller.numberImage.image = [self.contentList objectAtIndex:page]; 

其中,numberImage是一个UIImageView,controller是我在 ScrollView 中添加的 View Controller 的对象。当页面滚动到 View 之外时,我将图像设置为零

controller.numberImage.image = nil;

但问题是我的应用程序在滚动图像时内存不足,收到内存警告。每次显示新图像时,我都可以看到仪器工具(内存标签 70)中的内存增加,谷歌搜索结果是 ImageIO。请帮我解决这个问题

提前致谢

最佳答案

尝试删除 imageView ( [controller.numberImage removeFromSuperview]; ),然后在它即将进入 View 之前将其添加回来 ( [controller addSubview:[[UIImageView alloc] initWithImage :[self.contentList objectAtIndex:page]]]; )可能吗?

关于调用 nil 后 iPhone 内存没有释放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7815748/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com