Skip to content

Commit 387d695

Browse files
committed
Fix reset strategy
- Tapping was always enabled before. - Use setter to disable/enable tapping reset.
1 parent 1af9952 commit 387d695

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.m

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ @implementation ECSlidingViewController
7777
@synthesize underRightWidthLayout = _underRightWidthLayout;
7878
@synthesize underLeftWidthLayout = _underLeftWidthLayout;
7979
@synthesize shouldAllowUserInteractionsWhenAnchored;
80-
@synthesize resetStrategy;
80+
@synthesize resetStrategy = _resetStrategy;
8181

8282
// category properties
8383
@synthesize topViewSnapshot;
@@ -169,9 +169,10 @@ - (void)viewDidLoad
169169
{
170170
[super viewDidLoad];
171171
self.shouldAllowUserInteractionsWhenAnchored = NO;
172-
self.resetStrategy = ECTapping | ECPanning;
173172
self.resetTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resetTopView)];
174173
_panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(updateTopViewHorizontalCenterWithRecognizer:)];
174+
self.resetTapGesture.enabled = NO;
175+
self.resetStrategy = ECTapping | ECPanning;
175176

176177
self.topViewSnapshot = [[UIView alloc] initWithFrame:self.topView.bounds];
177178
[self.topViewSnapshot setAutoresizingMask:self.autoResizeToFillScreen];
@@ -199,6 +200,16 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO
199200
}
200201
}
201202

203+
- (void)setResetStrategy:(ECResetStrategy)theResetStrategy
204+
{
205+
_resetStrategy = theResetStrategy;
206+
if (_resetStrategy & ECTapping) {
207+
self.resetTapGesture.enabled = YES;
208+
} else {
209+
self.resetTapGesture.enabled = NO;
210+
}
211+
}
212+
202213
- (void)adjustLayout
203214
{
204215
self.topViewSnapshot.frame = self.topView.bounds;
@@ -279,7 +290,7 @@ - (void)anchorTopViewTo:(ECSide)side animations:(void (^)())animations onComplet
279290
}
280291
[self updateTopViewHorizontalCenter:newCenter];
281292
} completion:^(BOOL finished){
282-
if (resetStrategy & ECPanning) {
293+
if (_resetStrategy & ECPanning) {
283294
self.panGesture.enabled = YES;
284295
} else {
285296
self.panGesture.enabled = NO;

0 commit comments

Comments
 (0)