Skip to content

Commit 8e135af

Browse files
committed
Merge pull request ECSlidingViewController#29 from thomashempel/master
Adding notifications for left or right will disappear
2 parents 249d59e + 1b8f169 commit 8e135af

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ extern NSString *const ECSlidingViewUnderRightWillAppear;
1515
/** Notification that gets posted when the underLeft view will appear */
1616
extern NSString *const ECSlidingViewUnderLeftWillAppear;
1717

18+
/** Notification that gets posted when the underLeft view will disappear */
19+
extern NSString *const ECSlidingViewUnderLeftWillDisappear;
20+
21+
/** Notification that gets posted when the underRight view will disappear */
22+
extern NSString *const ECSlidingViewUnderRightWillDisappear;
23+
1824
/** Notification that gets posted when the top view is anchored to the left side of the screen */
1925
extern NSString *const ECSlidingViewTopDidAnchorLeft;
2026

ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.m

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
#import "ECSlidingViewController.h"
1010

11-
NSString *const ECSlidingViewUnderRightWillAppear = @"ECSlidingViewUnderRightWillAppear";
12-
NSString *const ECSlidingViewUnderLeftWillAppear = @"ECSlidingViewUnderLeftWillAppear";
13-
NSString *const ECSlidingViewTopDidAnchorLeft = @"ECSlidingViewTopDidAnchorLeft";
14-
NSString *const ECSlidingViewTopDidAnchorRight = @"ECSlidingViewTopDidAnchorRight";
15-
NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
11+
NSString *const ECSlidingViewUnderRightWillAppear = @"ECSlidingViewUnderRightWillAppear";
12+
NSString *const ECSlidingViewUnderLeftWillAppear = @"ECSlidingViewUnderLeftWillAppear";
13+
NSString *const ECSlidingViewUnderLeftWillDisappear = @"ECSlidingViewUnderLeftWillDisappear";
14+
NSString *const ECSlidingViewUnderRightWillDisappear = @"ECSlidingViewUnderRightWillDisappear";
15+
NSString *const ECSlidingViewTopDidAnchorLeft = @"ECSlidingViewTopDidAnchorLeft";
16+
NSString *const ECSlidingViewTopDidAnchorRight = @"ECSlidingViewTopDidAnchorRight";
17+
NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
1618

1719
@interface ECSlidingViewController()
1820

@@ -408,8 +410,22 @@ - (void)updateTopViewHorizontalCenter:(CGFloat)newHorizontalCenter
408410

409411
- (void)topViewHorizontalCenterWillChange:(CGFloat)newHorizontalCenter
410412
{
413+
414+
411415
CGPoint center = self.topView.center;
412416

417+
if (center.x >= self.resettedCenter && newHorizontalCenter == self.resettedCenter) {
418+
dispatch_async(dispatch_get_main_queue(), ^{
419+
[[NSNotificationCenter defaultCenter] postNotificationName:ECSlidingViewUnderLeftWillDisappear object:self userInfo:nil];
420+
});
421+
}
422+
423+
if (center.x <= self.resettedCenter && newHorizontalCenter == self.resettedCenter) {
424+
dispatch_async(dispatch_get_main_queue(), ^{
425+
[[NSNotificationCenter defaultCenter] postNotificationName:ECSlidingViewUnderRightWillDisappear object:self userInfo:nil];
426+
});
427+
}
428+
413429
if (center.x <= self.resettedCenter && newHorizontalCenter > self.resettedCenter) {
414430
[self underLeftWillAppear];
415431
} else if (center.x >= self.resettedCenter && newHorizontalCenter < self.resettedCenter) {

0 commit comments

Comments
 (0)