Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dimitribouniol/1026575 to your computer and use it in GitHub Desktop.
Save dimitribouniol/1026575 to your computer and use it in GitHub Desktop.
Simple property to check if a UIGestureRecognizer is tracking (like UIControl).
#import <UIKit/UIKit.h>
@interface UIGestureRecognizer (DBTrackingAdditions)
@property (nonatomic, readonly, getter=isTracking) BOOL tracking;
@end
#import "UIGestureRecognizer+DBTrackingAdditions.h"
@implementation UIGestureRecognizer (DBTrackingAdditions)
- (BOOL)isTracking
{
return (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment