在我的iPhone应用程序中延迟加载时,照片滚动变得粗糙(混蛋) [英] With lazy loading in my my iPhone app, photo scroll become rough (jerks)

查看:104
本文介绍了在我的iPhone应用程序中延迟加载时,照片滚动变得粗糙(混蛋)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个有一个视图的iPhone照片应用程序,其中我将在uiscrollview的帮助下显示通过该应用程序拍摄的所有图像. 首先,我只是将所有当前图像加载到scrollview中.但是它使应用变慢,并导致崩溃,并给出以下警告:

I am developing a iPhone photo app in which there is one view, where I am showing all the images taken through that app with the help of uiscrollview. First I simply loaded the scrollview with all the present images. But it made the app slow and also caused the crash giving the following warning:

Received memory warning. Level=2

我在Google上进行了很多搜索,发现这样做的原因可能是将如此重的图像全部加载到视图中,导致内存警告并随后崩溃.因此,我选择了延迟加载的概念.

I googled a lot and found that the reason for so may be loading such heavy images all together on a view are resulting in memory warning and crash afterwards. So I opt for the concept of lazy loading.

我只在其中加载三个图像,一个在中心(当前显示给用户),另外两个在两侧.我是通过以下方式做到的:

In which I was just loading the three images one at the center(currently shown to user) and the other two on either sides. I did that in following way:

   - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
     {
        pageNum = (int)(scrollView.contentOffset.x / scrollView.frame.size.width);
        pageNumber = floor(pageNum);
        [self setImages:pageNumber];      //setting three images
     }

现在没有崩溃,没有内存警告,但是滚动变得很粗糙,有很多抽搐.

Now there is no crash, no memory warning but the scroll has become quite rough with lots of jerks.

请建议我如何消除粗糙度或显示与iPhone默认照片应用程序相同的所有图像.

Please suggest me how to get rid the roughness or to show all the images same as iPhone 's default photo app.

非常感谢您的帮助.

注意: 1.没有未知的图像,可以是无限的. 2. Xcode 3.2.6 3. iOS SDK 4.3

Note: 1. No of images not known, can be unlimited. 2. Xcode 3.2.6 3. ios sdk 4.3

请考虑链接 [link] https://www.dropbox.com/sh/h0vwnhhx1acfcb5/W2TQ638udh 该链接显示了一个视频,其中我显示了一个嵌入了延迟加载的照片滚动器.有时它无法快速加载图像,因此滚动也变得很粗糙.

Please consider the link [link]https://www.dropbox.com/sh/h0vwnhhx1acfcb5/W2TQ638udh The link shows a video in which i have shown a photo scroller with lazy loading embedded. Some times it doesn't loads the images so fast also scrolling has become rough.

推荐答案

这是低内存警告,请参阅这些线程

this is low memry warning see these threads

iPhone操作系统内存警告.不同级别的含义是什么?

http://www.iphonedevsdk.com/forum/iphone-sdk-development/92778-received-memory-warning-level-2-17mb-used.html

iPhone内存警告级别= 2

收到的内存警告.级别= 2";与4.x?

这篇关于在我的iPhone应用程序中延迟加载时,照片滚动变得粗糙(混蛋)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆