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

Re: CATransactions not working


  • Subject: Re: CATransactions not working
  • From: Adam Radestock <email@hidden>
  • Date: Mon, 19 May 2008 19:03:37 +0100

This is actually on iPhone... Core Animation is always active on iPhone, there's no wantsLayer function...

Here is all the relevent code:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; {
	[self doHighlightEffect:SGUIButtonOpaqueEffect];
	[super touchesBegan:touches withEvent:event];
}

//- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; {
	[self doHighlightEffect:SGUIButtonSlideEffect];
	[super touchesEnded:touches withEvent:event];
}

- (void)doHighlightEffect:(SGUIButtonHighlightEffect)highlightEffect; {
[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];
}


On 19 May 2008, at 18:23, Brian Christensen wrote:

On May 19, 2008, at 1:06 , Adam Radestock wrote:

It's in a function called from within the mouseDown: handler in my subclass. I just don't get why the implicit animation isn't working?


A couple of things:

1) Make sure that somewhere up the hierarchy of your button's superviews one of them has the "Wants Layer" option in IB checked, or that you're setting "[someSuperviewOfCustomButton setWantsLayer:YES]" in code somewhere.

2) If #1 isn't the issue, it would help if you posted your entire mouseDown: method. I have run into an issue with animations not happening when they should be, but I don't know if your issue is the same as the one I had recently without seeing more context.

/brian


_______________________________________________

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:
    • [MODERATOR] Re: CATransactions not working
      • From: Scott Anguish <email@hidden>
    • Re: CATransactions not working
      • From: "Paul Bailey" <email@hidden>
References: 
 >CATransactions not working (From: Adam Radestock <email@hidden>)
 >Re: CATransactions not working (From: Adam Radestock <email@hidden>)
 >Re: CATransactions not working (From: Brian Christensen <email@hidden>)

  • Prev by Date: Re: Cocoa et al as HCI usability problem
  • Next by Date: Re: CATransactions not working
  • Previous by thread: Re: CATransactions not working
  • Next by thread: Re: CATransactions not working
  • Index(es):
    • Date
    • Thread