On Feb 1, 2011, at 4:32 AM, Roland King wrote:

> I have a UIView subclass in my iOS app and the content for that UIView is 3 
> CALayers, each with a bitmap image for their content, added as sublayers of 
> the UIView's layer. Each of the CALayers is the full size of the UIView's 
> layer (they have transparency to composite them together). 
> 
> When the UIView is resized the setFrame: method is called and I have a custom 
> implementation of that which sets the bounds of the sublayers so they again 
> fill the UIView's layer, and draws a new bitmap for each of them of the right 
> size and sets it into their contents. 
> 
> However, when I resize, there's a brief flash of the current content, before 
> it's been redrawn, stretched to fill the new sized window, before the new 
> content replaces it. Nothing I've tried has been able to stop that brief 
> flash and I can't figure out where it's coming from. 


I suppose my first question is why not just use UIViews instead? They should 
already abstract all of what you need to make this work away from you, and you 
should only need to set the view's contentMode property to 
UIViewContentModeRedraw to get the behavior you seem to desire. Then it would 
just be a matter of teaching the UIViews how to draw themselves to generate 
their own content instead of having the parent UIView do so and push it to them.

As for overall, I'm not entirely certain what is happening, but it sounds like 
you have a timing issue, possibly one where the view's are resized on one 
runloop invocation and their contents replaced on the next. Instead of 
overriding -setFrame: you should override -layoutSubViews: which should catch 
more cases where layout is needed and allow you to do the work you need at the 
right time.
--
David Duncan

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to