views:

22

answers:

1

Hi all.

I have a single image that needs to be placed on multiple UIImageView.

I am wondering whether there is a way to save the memory in doing this?

For e.g., I have a pic file. I can create one UIImage object for this file. If I create multiple UIImageView and init them with the single UIImage Object, will that save the memory?

thanks

+1  A: 

Yes, it will save memory compared to one UIImage per UIImageView. How significant will it be? To find out, you'll have to run it both ways and watch the memory allocations by Instruments.

John Franklin
Are you sure I am allowed to attach single UIImage to multiple UIImageView? I am going to display a rich image in 20 UIImageView, I guess it may save a lot if I am allowed to. Thanks
Jack
I've never tried it, but since the image property in the UIImageView is declared `retain` and not `copy` I would expect it to work. I also see nothing in the documentation to suggest that using one UIImage in multiple UIImageViews would fail.
John Franklin