UIImageView UIScrollView 高分辨率图像内存警告
我正在 iPad 上的 UIScrollView 中填充 10 张以上的横向模式(1024x768)全屏照片。我面临着一个非常大的问题:我使用 GDC 异步加载所有 UIImageView,并将所有视图添加到 ScrollView 作为子视图。 当我加载不同的图库时,首先删除 UIScrollVIew 中的所有视图,然后异步重新加载所有内容。 如果我不快速地在图库之间切换,那没有问题;相反,如果我在画廊和其他画廊之间切换,我会收到不同的内存警告并且应用程序崩溃。我用仪器查看,但没有泄漏,并且当我将所有视图添加到子视图时内存消耗很大,但它没有提高。 可能是什么问题?也许我可以使用 NSAutoreleasePool 来强制清除对象?
I'm populating a UIScrollView on iPad with above 10 photos fullscreen in landscape mode (1024x768). I'm facing out a very big problem: I load all the UIImageView asynchronously using GDC, and the add all the view to the ScrollView as subview.
When I load a different gallery, first I remove all the View in the UIScrollVIew, and then reload asynchronously all the thing.
If I don't switch between the gallery fast, there's no problem; instead, if I switch between a gallery and other, I receive different memory warning and the application crash. I look with instruments, but there's no leak and the memory consumpion is intensive when I add all the view to subview, but it's not raising.
What can be the problem? Maybe I can use NSAutoreleasePool to force the purging of objects?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当你在scrollView中使用最大分辨率的照片时,你可能会面临内存问题
如果你有一个小的scrollView并且你想显示缩略图,你不能使用全尺寸的照片作为缩略图,你应该在pixelmator,Photoshop等中创建一张小照片使用这种方法的照片,您不会遇到内存问题
如果您有一个带有全屏图像视图的全屏滚动视图,您可以从SuperView中删除使用这种方法在滚动视图中不可见的图像,所有内存问题都会消失
我希望这有帮助
祝你好运
When you use max resolution photos inside scrollView you can face memory problems
If you have a small scrollView and you want to show thumbnails you can't use the full size photo for the thumbnail you should create in pixelmator, Photoshop etc. a small photo of your photos with this approach you won't face memory problems
If you have a full screen scrollView with full screen imageViews you can remove fromSuperView the images that aren't visible in the scrollView with this approach all your memory problems will disappear
I hope this help
Good luck