简体   繁体   English

应用程序像iPhone中的默认照片浏览器一样?

[英]App like default photo browser in iphone?

i am developing a app which contains feature like default photo browser in iphone. 我正在开发一个应用程序,其中包含iPhone中默认照片浏览器之类的功能。 I done some what similar to that. 我做了一些类似的事情。 but after loading some(near about 10-15) images from remote server,i am receiving memory warning.My requirement is loading image one by one. 但是从远程服务器加载了一些(大约10-15张)图像后,我收到了内存警告。我的要求是一张一张地加载图像。 For this, on scroll view i am putting an images and increasing the contentSize of scroll view. 为此,在滚动视图上我要放置图像并增加滚动视图的contentSize。 it will work fine. 它将正常工作。 but due to memory warning app quite. 但由于内存警告应用程序相当。

Guys, any have any idea to approach for this feature which work similar to photo app without problem? 伙计们,有没有什么想法可以使用此功能,而该功能类似于照片应用程序却没有问题?

thanks in advance . 提前致谢 。

You're running out of memory because you're keeping the data for 10 or more images in memory at one time. 您用完了内存,因为您一次将10个或更多图像的数据保留在内存中。 You need to have more logic in your code that not only preloads and increases the scroll view's content size, but also removes UIImageViews from the scrollview (and thus from memory) as the user scrolls to newer stuff. 您需要在代码中拥有更多的逻辑,这些逻辑不仅可以预加载和增加滚动视图的内容大小,而且还可以在用户滚动到新内容时从滚动视图(从而从内存)中删除UIImageViews。 (You can also save "evicted" images to the cache area on disk so if the users scrolls back you don't have to go to the server again.) (您还可以将“已删除”的图像保存到磁盘上的缓存区域,因此,如果用户向后滚动,则无需再次访问服务器。)

If you use a UITableView, it will request the images only when needed, and will automatically purge off-screen cells to save memory. 如果使用UITableView,它将仅在需要时请求图像,并且将自动清除屏幕外的单元以节省内存。 It may not fit into the aesthetic for your application, though. 但是,它可能不适合您的应用程序的美学要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在我的应用程序中实现“选择现有照片”,如默认的iPhone电话簿? - how do I implement “Choose Existing Photo” in my app like in default iphone phonebook? iPhone:如何通过iPhone照片应用程序等“编辑”功能从照片库或相机中获取图像 - iPhone:How to fetch image from photo library or camera with “edit” funcitionality like iPhone photo app 如何像iPhone的照片应用程序一样实现删除动画 - How to implement delete animation like iPhone's photo app 创建多个图像视图,例如照片应用程序iphone sdk - create multiple images view like the photo app iphone sdk iPhone显示照片/图像滑动(如照片库和Facebook应用程序)? - iPhone show photos/images sliding (like photo library and Facebook app)? 使用UIImageView制作类似iPhone的Photo Galerry的应用 - Using UIImageView to make a app like iPhone's Photo Galerry 在iPhone应用程序中将视图另存为照片 - Saving a View as a Photo in iPhone App 像iPhone默认邮件应用一样实现动画撰写邮件 - Implement animation like iPhone default mail app compose mail 默认的相机iPhone应用程序如何设置如此快速地保存照片? - How does the default Camera iPhone app manages to save a photo so fast? 如何使用iPhone SDK实现像Photo应用程序的可滑动图像堆栈? - How do you implement swipe-able image stacks like the Photo app using the iPhone SDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM