Skip to content

Commit

Permalink
Rewrote -[TUIView actionForLayer:forKey:] to correct the logic for di…
Browse files Browse the repository at this point in the history
…sableAnimations, and to use the current TUIView animation with TUICAAction
  • Loading branch information
jspahrsummers committed Jul 18, 2012
1 parent b36c83e commit 2f9520e
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions lib/UIKit/TUIView+Animation.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,29 +288,17 @@ - (void)removeAllAnimations

- (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event
{
if(disableAnimations == NO) {
if((animateContents == NO) && [event isEqualToString:@"contents"])
return (id<CAAction>)[NSNull null]; // default - don't animate contents

id<CAAction>animation = [TUIView _currentAnimation];
if(animation)
return animation;
}

id defaultAction = [NSNull null];
if (![TUICAAction interceptsActionForKey:event])
return defaultAction;

// If we're being called inside the [layer actionForKey:key] call below,
// so return the default action.
if (self.recursingActionForLayer)
return defaultAction;
if(disableAnimations == YES)
return (id)[NSNull null];

self.recursingActionForLayer = YES;
id<CAAction> innerAction = [layer actionForKey:event];
self.recursingActionForLayer = NO;
if((animateContents == NO) && [event isEqualToString:@"contents"])
return (id<CAAction>)[NSNull null]; // default - don't animate contents

return [TUICAAction actionWithAction:innerAction];
id animation = [TUIView _currentAnimation];
if ([TUICAAction interceptsActionForKey:event])
return [TUICAAction actionWithAction:animation];
else
return animation;
}

@end

0 comments on commit 2f9520e

Please sign in to comment.