Permalink
Browse files

Rewrote -[TUIView actionForLayer:forKey:] to correct the logic for di…

…sableAnimations, and to use the current TUIView animation with TUICAAction
  • Loading branch information...
jspahrsummers committed Jul 18, 2012
1 parent b36c83e commit 2f9520e9f23750fb037a2cb68505013c99477a2b
Showing with 9 additions and 21 deletions.
  1. +9 −21 lib/UIKit/TUIView+Animation.m
@@ -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.