Skip navigation.
 
mlCore Animation layout behavior during live window resize
FROM : Ben Kazez
DATE : Wed Feb 06 21:12:35 2008

Hi,

I have a layer-backed view that resizes to fit the available space in 
the window. During live window resizes, I'd like the layers to resize 
with no animation.

1. I get a crash when I begin a transaction and use 
kCATransactionDisableActions within the layout manager's -
layoutSublayersOfLayer method.

2. Disabling actions within a transaction from viewWillStartLiveResize/
viewDidEndLiveResize seems to disable the animation, but I can't be 
sure, because the view content isn't updated properly: The background 
color of the root layer is not redrawn, and the layers do not 
reposition themselves.

3. To fix #2, I tried setAutoresizesSubviews:YES and laying out the 
root layer (-layoutIfNeeded or -setNeedsLayout) from -
resizeSubviewsWithOldSize, but this had no effect.

4. As a proof of concept, I tried unsetting the root layer from the 
view (setLayer:nil) and setting wantsLayer:NO, and then drawing a 
plain black background in -drawRect during live resizes. (My thinking 
was that eventually I'd render the root layer contents to an image and 
scale the image to provide a low-resolution preview during live window 
resizes.) However, this caused crazy drawing artifacts and window 
flickering.

I'm surely missing something obvious. What's the recommended way of 
doing this?

Ben

Related mailsAuthorDate
mlCore Animation layout behavior during live window resize Ben Kazez Feb 6, 21:12
mlRe: Core Animation layout behavior during live window resize Troy Stephens Feb 7, 01:34
mlRe: Core Animation layout behavior during live window resize Ben Kazez Feb 7, 02:50