Skip to content

Commit

Permalink
Add support of disable showing of view for some time period
Browse files Browse the repository at this point in the history
  • Loading branch information
brightsider authored and Friend-LGA committed Nov 30, 2015
1 parent 26e5a94 commit cda3e47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions LGSideMenuController/LGSideMenuController.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ typedef NS_ENUM(NSUInteger, LGSideMenuSwipeGestureArea)
- (void)hideRightViewAnimated:(BOOL)animated completionHandler:(void(^)())completionHandler;
- (void)showHideRightViewAnimated:(BOOL)animated completionHandler:(void(^)())completionHandler;

- (BOOL)shouldShowLeftView;
- (BOOL)shouldShowRightView;

/** Unavailable, select it on your rootViewController */
- (BOOL)shouldAutorotate __attribute__((unavailable("select it on your rootViewController")));
/** Unavailable, select it on your rootViewController */
Expand Down
12 changes: 10 additions & 2 deletions LGSideMenuController/LGSideMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ - (void)setGesturesCancelsTouchesInView:(BOOL)gesturesCancelsTouchesInView
_panGesture.cancelsTouchesInView = gesturesCancelsTouchesInView;
}

- (BOOL)shouldShowLeftView {
return YES;
}

- (BOOL)shouldShowRightView {
return YES;
}

#pragma mark - Layout Subviews

- (void)leftViewWillLayoutSubviewsWithSize:(CGSize)size
Expand Down Expand Up @@ -1624,7 +1632,7 @@ - (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer

// -----

if (_leftView && self.isLeftViewSwipeGestureEnabled && !kLGSideMenuIsLeftViewAlwaysVisible && !_rightViewGestireStartX && !self.isRightViewShowing)
if (_leftView && self.isLeftViewSwipeGestureEnabled && !kLGSideMenuIsLeftViewAlwaysVisible && !_rightViewGestireStartX && !self.isRightViewShowing && [self shouldShowLeftView])
{
if (!_leftViewGestireStartX && (gestureRecognizer.state == UIGestureRecognizerStateBegan || gestureRecognizer.state == UIGestureRecognizerStateChanged))
{
Expand Down Expand Up @@ -1677,7 +1685,7 @@ - (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer

// -----

if (_rightView && self.isRightViewSwipeGestureEnabled && !kLGSideMenuIsRightViewAlwaysVisible && !_leftViewGestireStartX && !self.isLeftViewShowing)
if (_rightView && self.isRightViewSwipeGestureEnabled && !kLGSideMenuIsRightViewAlwaysVisible && !_leftViewGestireStartX && !self.isLeftViewShowing && [self shouldShowRightView])
{
if (!_rightViewGestireStartX && (gestureRecognizer.state == UIGestureRecognizerStateBegan || gestureRecognizer.state == UIGestureRecognizerStateChanged))
{
Expand Down

0 comments on commit cda3e47

Please sign in to comment.