Skip to content

Instantly share code, notes, and snippets.

@cacaodev
Created November 2, 2016 09:57
Show Gist options
  • Save cacaodev/10e803cf0ddf361688d393f7191faf26 to your computer and use it in GitHub Desktop.
Save cacaodev/10e803cf0ddf361688d393f7191faf26 to your computer and use it in GitHub Desktop.
Ask the animator if he wants frame updates for a given key path
- (id)initWithTarget:(id)aTarget
{
self = [super initWithTarget:aTarget];
_wantsPeriodicFrameUpdates = NO;
return self;
}
- (void)requestPeriodicFrameUpdates
{
_wantsPeriodicFrameUpdates = YES;
}
- (void)_needsPeriodicFrameUpdatesForKeyPath:(CPString)aKeyPath
{
return ((aKeyPath == @"frame" || aKeyPath == @"frameSize") && ([_target hasCustomLayoutSubviews] || [_target hasCustomDrawRect])) || _wantsPeriodicFrameUpdates;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment