Re: CATransactions not working
Re: CATransactions not working
- Subject: Re: CATransactions not working
- From: "Paul Bailey" <email@hidden>
- Date: Mon, 19 May 2008 19:09:05 +0100
Unfortunately, by mentioning the magic word ("iPhone"), you won't be getting
any answers on this mailing list, since the iPhone SDK is still under an
NDA...
Cheers,
Paul
On Mon, May 19, 2008 at 7:03 PM, Adam Radestock <email@hidden>
wrote:
> 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
>
_______________________________________________
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