How can I stop the iPhone from displaying a transform change until after the screen is redrawn

Posted by Ed Marty on Stack Overflow See other posts from Stack Overflow or by Ed Marty
Published on 2009-06-11T16:47:05Z Indexed on 2010/06/10 14:42 UTC
Read the original article Hit count: 215

Filed under:

I have found the UIScrollView's zooming mechanism to be clunk and essentially unusable. So instead, I'm rolling my own. I have a UIView that resizes itself with the pinch-zoom, and that's working fine. When the zoom is complete, the view needs to reset its transform and redraw the images.

The zoom works essentially in the same way the UIScrollView does. It sets the transform property of the UIView until complete. Then, when the zoom finishes, I want to reset the transform to CGAffineTransformIdentity, resize the frame to be the size it was before, and tell the view to redraw itself at the new size.

It all works pretty well, except when I change the transform to identity then redraw the image, there is a slight flicker before the image completely redraws. This is due to the fact that I'm using a subclass of CATiledLayer, since the view can be of arbitrary size.

I've overridden the fadeDuration to be zero, but there is still a flicker while the transform is reset before the redraw is finished. Is there any simple way to overcome this without creating another view to draw with then replacing it?

© Stack Overflow or respective owner

Related posts about iphone-sdk