Reputation: 7227
My UIScrollView is very very long in width, and it contains thousands of UIImageView objects.
Does the above UIScrollView and UIImageView objects consume a lot of memory ?
When an UIImageView object is scrolled away from the visible area, will it be auto released to free the memory ?
Any good approach to manage the memory in the above scenario ?
Thanks.
Upvotes: 2
Views: 1331
Reputation: 12036
For the first question Yes, they will consume al lot of memory.
For the second question No they will not be released. When you add an view to your scroll view "addSubView" it will send an retain to that object. So you also need to remove that view from the superView in your case your scroll view. You can tag all your image view and when is out of screen you can remove it from super view to keep memory usage low.
This is best explained in WWDC 2010 Session Videos in Session 104 - Designing Apps with Scroll Views. You find this for free in iTunes U
Upvotes: 4