I have a grid of views. Each view contains an image and some lightweight elements.
Each such view may become fullscreen and vice versa. So I used CATransform3D
to minimize/maximize the item and constant "fullscreen" frame (I can't simply decrease/increase frame/bounds because the transform includes additional subtransforms not scale only).
But now I have the another problem. The frame of each view is always big so the image inside it must be big too and it causes memory troubles. I tried to decrease the image size in pixels but the whole image is reduced (as usually) relatively to its container.
How to solve such issue? I don't need the image of maximum size after its minimization (even if it decreases its quality).
Edited
Especially for those offended ones who wants to get additional votes without efforts and tries to retell the question instead of answering and suggests to reduce the image size in pixels - read the question again because it is already specified and here is that incorrect result:
http://i62.tinypic.com/mr67ue.jpg
Okay, the image size is reduced but what to do with its container?
The most appropriate solution I found out is the following.
The unoptimized view is of the screen size and all the other transforms including scale are applied via CATransform3D
.
To optimize I reduce the frame of the UIView
, all of its subviews and even image manually (because in my case its placement mode in UIImageView
doesn't meet any standard one). I still use the same complex CATransform3D
but without scaling transform.
In both cases the initial anchor point (views' center) is the center of the screen.
To optimize the image I reduce its size immediately for current view and use cached ones for other views. If there is no cached image I try to recreate it.