• 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
CATransactions not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CATransactions not working


  • Subject: CATransactions not working
  • From: Adam Radestock <email@hidden>
  • Date: Sun, 18 May 2008 17:00:36 +0100

Hi everyone,

I've been struggling to work out how to animate some properties on my NSButton subclass. I have looked through all the examples given in Apple's docs, but can't work out why my code doesn't animate.

My code is:
[CATransaction begin]; // Begin grouping animated property changes

if (highlightEffect == SGUIButtonOpaqueEffect) {

[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:5.0f]
forKey:kCATransactionAnimationDuration];
self.layer.opacity = 1.0;
[CATransaction commit];

} else if (highlightEffect == SGUIButtonSlideEffect) {

[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:1.0f]
forKey:kCATransactionAnimationDuration];
self.layer.bounds = CGRectMake(self.layer.position.x, self.layer.position.y, self.bounds.size.width + 10, self.bounds.size.height);
[CATransaction commit];

[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:2.0f]
forKey:kCATransactionAnimationDuration];
self.layer.position = CGPointMake(self.layer.position.x - self.layer.bounds.size.width, self.layer.position.y);
[CATransaction commit];

}

[CATransaction commit];


Can anyone see any problems with this? Why aren't there any animations when this code executes?

Any help greatly appreciated.

Adam Radestock
Glass Monkey Software
_______________________________________________

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: CATransactions not working
      • From: Brian Christensen <email@hidden>
  • Prev by Date: NSStream, NSInputStream, NSOutputStream
  • Next by Date: Re: Cocoa et al as HCI usability problem
  • Previous by thread: Re: NSStream, NSInputStream, NSOutputStream
  • Next by thread: Re: CATransactions not working
  • Index(es):
    • Date
    • Thread