mirror of
https://github.com/zhigang1992/ECSlidingViewController.git
synced 2026-01-12 22:46:53 +08:00
@@ -123,6 +123,14 @@ typedef enum {
|
||||
*/
|
||||
@property (nonatomic, unsafe_unretained) BOOL shouldAllowUserInteractionsWhenAnchored;
|
||||
|
||||
/** Specifies if the top view snapshot requires a pan gesture recognizer.
|
||||
|
||||
This is useful when panGesture is added to the navigation bar instead of the main view.
|
||||
|
||||
By default, this is set to NO
|
||||
*/
|
||||
@property (nonatomic, unsafe_unretained) BOOL shouldAddPanGestureRecognizerToTopViewSnapshot;
|
||||
|
||||
/** Specifies the behavior for the under left width
|
||||
|
||||
By default, this is set to ECFullWidth
|
||||
|
||||
@@ -24,6 +24,7 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidRese
|
||||
@property (nonatomic, unsafe_unretained) CGFloat initialHoizontalCenter;
|
||||
@property (nonatomic, strong) UIPanGestureRecognizer *panGesture;
|
||||
@property (nonatomic, strong) UITapGestureRecognizer *resetTapGesture;
|
||||
@property (nonatomic, strong) UIPanGestureRecognizer *topViewSnapshotPanGesture;
|
||||
@property (nonatomic, unsafe_unretained) BOOL underLeftShowing;
|
||||
@property (nonatomic, unsafe_unretained) BOOL underRightShowing;
|
||||
@property (nonatomic, unsafe_unretained) BOOL topViewIsOffScreen;
|
||||
@@ -80,6 +81,7 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidRese
|
||||
@synthesize underRightWidthLayout = _underRightWidthLayout;
|
||||
@synthesize underLeftWidthLayout = _underLeftWidthLayout;
|
||||
@synthesize shouldAllowUserInteractionsWhenAnchored;
|
||||
@synthesize shouldAddPanGestureRecognizerToTopViewSnapshot;
|
||||
@synthesize resetStrategy = _resetStrategy;
|
||||
|
||||
// category properties
|
||||
@@ -91,6 +93,7 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidRese
|
||||
@synthesize underLeftShowing = _underLeftShowing;
|
||||
@synthesize underRightShowing = _underRightShowing;
|
||||
@synthesize topViewIsOffScreen = _topViewIsOffScreen;
|
||||
@synthesize topViewSnapshotPanGesture = _topViewSnapshotPanGesture;
|
||||
|
||||
- (void)setTopViewController:(UIViewController *)theTopViewController
|
||||
{
|
||||
@@ -176,6 +179,7 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidRese
|
||||
{
|
||||
[super viewDidLoad];
|
||||
self.shouldAllowUserInteractionsWhenAnchored = NO;
|
||||
self.shouldAddPanGestureRecognizerToTopViewSnapshot = NO;
|
||||
self.resetTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resetTopView)];
|
||||
_panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(updateTopViewHorizontalCenterWithRecognizer:)];
|
||||
self.resetTapGesture.enabled = NO;
|
||||
@@ -448,10 +452,17 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidRese
|
||||
|
||||
- (void)addTopViewSnapshot
|
||||
{
|
||||
if (!self.topViewSnapshot.superview && !self.shouldAllowUserInteractionsWhenAnchored) {
|
||||
topViewSnapshot.layer.contents = (id)[UIImage imageWithUIView:self.topView].CGImage;
|
||||
[self.topView addSubview:self.topViewSnapshot];
|
||||
}
|
||||
if (!self.topViewSnapshot.superview && !self.shouldAllowUserInteractionsWhenAnchored) {
|
||||
topViewSnapshot.layer.contents = (id)[UIImage imageWithUIView:self.topView].CGImage;
|
||||
|
||||
if (self.shouldAddPanGestureRecognizerToTopViewSnapshot && (_resetStrategy & ECPanning)) {
|
||||
if (!_topViewSnapshotPanGesture) {
|
||||
_topViewSnapshotPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(updateTopViewHorizontalCenterWithRecognizer:)];
|
||||
}
|
||||
[topViewSnapshot addGestureRecognizer:_topViewSnapshotPanGesture];
|
||||
}
|
||||
[self.topView addSubview:self.topViewSnapshot];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeTopViewSnapshot
|
||||
|
||||
Reference in New Issue
Block a user