Hi,
Recently I've been trying to save on render time by minimizing the amount of time spent on allocation and duplication of resources as images by using an already allocated UIImageViews and UIImages.
What I try to do is maintain a map of all UIImages - each one unique, and reassign each one to to several UIImageViews, by demand from the game engine. As the game progresses I remove some UIImageViews from display, and later might reuse them with different preloaded UIImages.
The first time I create the UIImageView I do something like:
m_ImageView = [[UIImageView alloc] initWithImage : initialImg];
[m_ParentView addSubview: m_ImageView];
And the following times I simply switch the image:
[m_ImageView.image release];
[m_ImageView setImage otherSavedImg];
The problem is that after the switch, the new image size as displayed is identical to the initial image size. I bypassed the problem by recreating the UIImageView every time (which seems like a waste of time), but I am wondering both why this happens and how can I prevent it.
Thanks,