• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CALayer instant content update
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CALayer instant content update


  • Subject: CALayer instant content update
  • From: Markus Spoettl <email@hidden>
  • Date: Fri, 3 Sep 2010 13:36:39 -0400

Hello,

  during the recent discussion "CALayer -drawInContext and GCD" it came up that you should not use [CATransation flush] and the argument made a point that it wasn't necessary and should be avoided because of negative consequences. I'm a little confused now as it seems -flush does help me achieve something that I don't know how to do otherwise.

I have delegate-drawn layers (on the main thread) whose content I want to change without animation, I don't want to a change transition of any kind in some situations. Up until now I'm using this:

    [CATransaction flush];
    [CATransaction begin];
    [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];

    [self applyLayerFrame];  //changes position of the layer, layer possibly bounds too
    [layer setNeedsDisplay];

    [CATransaction commit];

Which works exactly as planed, both frame and content change instantly. If I remove the call to -flush the frame changes without animation but the content change is animated.

Given the argument I surely must be doing something wrong. No matter where I put the [layer setNeedsDisplay] call, the content change is always animated. It only works like I want it if I use flush AND put -setNeedsDisplay where it is now.

So, what's the correct method of updating a delegate-drawn layer's content without animating the change?

Regards
Markus

PS: The GeekGameBoard demo project uses flush a lot, I think I got the idea from there.
--
__________________________________________
Markus Spoettl

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: CALayer instant content update
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: UIView animation
  • Next by Date: Re: CALayer instant content update
  • Previous by thread: Re: where are the CALayer struts and springs on iPhone?
  • Next by thread: Re: CALayer instant content update
  • Index(es):
    • Date
    • Thread