From 5a8e2dc2ab81d4be8a07c941e3f5fccbed1164d5 Mon Sep 17 00:00:00 2001 From: Jerrold Poh Date: Wed, 20 Feb 2013 15:12:40 +1300 Subject: [PATCH] Added property where user can set the minimum panning distance Still uses the HH_PANNING_MINIMUM_PAN constant as the default panning distance, though this can be overridden later by the user --- HHPanningTableViewCell/HHPanningTableViewCell.h | 1 + HHPanningTableViewCell/HHPanningTableViewCell.m | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HHPanningTableViewCell/HHPanningTableViewCell.h b/HHPanningTableViewCell/HHPanningTableViewCell.h index 1d3617d..74f1650 100644 --- a/HHPanningTableViewCell/HHPanningTableViewCell.h +++ b/HHPanningTableViewCell/HHPanningTableViewCell.h @@ -48,6 +48,7 @@ typedef enum { @property (nonatomic, assign) NSInteger directionMask; @property (nonatomic, assign) BOOL shouldBounce; +@property (nonatomic, assign) CGFloat minimumPan; @property (nonatomic, weak) id delegate; - (BOOL)isDrawerRevealed; diff --git a/HHPanningTableViewCell/HHPanningTableViewCell.m b/HHPanningTableViewCell/HHPanningTableViewCell.m index 9c85cb4..2b1657d 100644 --- a/HHPanningTableViewCell/HHPanningTableViewCell.m +++ b/HHPanningTableViewCell/HHPanningTableViewCell.m @@ -85,6 +85,9 @@ static HHPanningTableViewCellDirection HHOppositeDirection(HHPanningTableViewCel if (self != nil) { [self panningTableViewCellInit]; } + + // Note, minimum pan distance can be overridden + self.minimumPan = HH_PANNING_MINIMUM_PAN; return self; } @@ -437,7 +440,7 @@ static HHPanningTableViewCellDirection HHOppositeDirection(HHPanningTableViewCel CGFloat totalPanX = translation.x; if (!self.panning) { - if (fabsf(totalPanX) <= HH_PANNING_MINIMUM_PAN) { + if (fabsf(totalPanX) <= self.minimumPan) { totalPanX = 0.0f; } else {