Skip to content

Commit db7100d

Browse files
NatashaTheRobotenriquez
authored andcommitted
the view is done editing when a pan gesture is started or menu button is tapped, so keyboard is resigned if it is currently active on the view, slight refactoring
1 parent 666db6f commit db7100d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

ECSlidingViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ECSlidingViewController"
3-
s.version = "2.0.1"
3+
s.version = "2.0.2"
44
s.summary = "View controller container that presents its child view controllers in two sliding layers. Inspired by the Path 2.0 and Facebook iPhone apps."
55
s.description = "ECSlidingViewController is a view controller container that presents its child view controllers in two layers. It provides functionality for sliding the top view to reveal the views underneath it. This functionality is inspired by the Path 2.0 and Facebook iPhone apps."
66
s.homepage = "https://github.com/ECSlidingViewController/ECSlidingViewController"

ECSlidingViewController/ECSlidingViewController.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,28 +424,27 @@ - (void)resetTopViewAnimated:(BOOL)animated {
424424
}
425425

426426
- (void)anchorTopViewToRightAnimated:(BOOL)animated onComplete:(void (^)())complete {
427-
self.isAnimated = animated;
428-
self.animationComplete = complete;
429-
ECSlidingViewControllerOperation operation = [self operationFromPosition:self.currentTopViewPosition toPosition:ECSlidingViewControllerTopViewPositionAnchoredRight];
430-
[self animateOperation:operation];
427+
[self resetViewAnimated:animated toPosition:ECSlidingViewControllerTopViewPositionAnchoredRight onComplete:complete];
431428
}
432429

433430
- (void)anchorTopViewToLeftAnimated:(BOOL)animated onComplete:(void (^)())complete {
434-
self.isAnimated = animated;
435-
self.animationComplete = complete;
436-
ECSlidingViewControllerOperation operation = [self operationFromPosition:self.currentTopViewPosition toPosition:ECSlidingViewControllerTopViewPositionAnchoredLeft];
437-
[self animateOperation:operation];
431+
[self resetViewAnimated:animated toPosition:ECSlidingViewControllerTopViewPositionAnchoredLeft onComplete:complete];
438432
}
439433

440434
- (void)resetTopViewAnimated:(BOOL)animated onComplete:(void(^)())complete {
435+
[self resetViewAnimated:animated toPosition:ECSlidingViewControllerTopViewPositionCentered onComplete:complete];
436+
}
437+
438+
#pragma mark - Private
439+
440+
- (void)resetViewAnimated:(BOOL)animated toPosition:(ECSlidingViewControllerTopViewPosition)position onComplete:(void(^)())complete {
441441
self.isAnimated = animated;
442442
self.animationComplete = complete;
443-
ECSlidingViewControllerOperation operation = [self operationFromPosition:self.currentTopViewPosition toPosition:ECSlidingViewControllerTopViewPositionCentered];
443+
[self.view endEditing:YES];
444+
ECSlidingViewControllerOperation operation = [self operationFromPosition:self.currentTopViewPosition toPosition:position];
444445
[self animateOperation:operation];
445446
}
446447

447-
#pragma mark - Private
448-
449448
- (CGRect)topViewCalculatedFrameForPosition:(ECSlidingViewControllerTopViewPosition)position {
450449
CGRect frameFromDelegate = [self frameFromDelegateForViewController:self.topViewController
451450
topViewPosition:position];
@@ -740,6 +739,7 @@ - (void)updateTopViewGestures {
740739

741740
- (void)detectPanGestureRecognizer:(UIPanGestureRecognizer *)recognizer {
742741
if (recognizer.state == UIGestureRecognizerStateBegan) {
742+
[self.view endEditing:YES];
743743
_isInteractive = YES;
744744
}
745745

0 commit comments

Comments
 (0)