Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed Swift compile error (added import UIKit) #192

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Demos/MFSideMenuDemoAnimations
Submodule MFSideMenuDemoAnimations deleted from 739cde
14 changes: 9 additions & 5 deletions MFSideMenu/MFSideMenuContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ - (UIStatusBarStyle)preferredStatusBarStyle {
#pragma mark -
#pragma mark - UIViewController Rotation

-(NSUInteger)supportedInterfaceOrientations {
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
if (self.centerViewController) {
if ([self.centerViewController isKindOfClass:[UINavigationController class]]) {
return [((UINavigationController *)self.centerViewController).topViewController supportedInterfaceOrientations];
Expand Down Expand Up @@ -220,6 +220,7 @@ - (void)setLeftMenuViewController:(UIViewController *)leftSideMenuViewController
}

- (void)setCenterViewController:(UIViewController *)centerViewController {
[self setUserInteractionStateForCenterViewController:YES];
[self removeCenterGestureRecognizers];
[self removeChildViewControllerFromContainer:_centerViewController];

Expand All @@ -228,6 +229,7 @@ - (void)setCenterViewController:(UIViewController *)centerViewController {
if(!_centerViewController) return;

[self addChildViewController:_centerViewController];
centerViewController.view.frame = self.view.bounds;
[self.view addSubview:[_centerViewController view]];
[((UIViewController *)_centerViewController) view].frame = (CGRect){.origin = origin, .size=centerViewController.view.frame.size};

Expand Down Expand Up @@ -351,7 +353,7 @@ - (void)setMenuState:(MFSideMenuState)menuState completion:(void (^)(void))compl
void (^innerCompletion)() = ^ {
_menuState = menuState;

[self setUserInteractionStateForCenterViewController];
[self setUserInteractionStateForCenterViewController:(menuState == MFSideMenuStateClosed)];
MFSideMenuStateEvent eventType = (_menuState == MFSideMenuStateClosed) ? MFSideMenuStateEventMenuDidClose : MFSideMenuStateEventMenuDidOpen;
[self sendStateEventNotification:eventType];

Expand Down Expand Up @@ -547,7 +549,7 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceive
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
CGPoint velocity = [(UIPanGestureRecognizer *)gestureRecognizer velocityInView:gestureRecognizer.view];
BOOL isHorizontalPanning = fabsf(velocity.x) > fabsf(velocity.y);
BOOL isHorizontalPanning = fabs(velocity.x) > fabs(velocity.y);
return isHorizontalPanning;
}
return YES;
Expand Down Expand Up @@ -710,16 +712,18 @@ - (void)centerViewControllerTapped:(id)sender {
}
}

- (void)setUserInteractionStateForCenterViewController {
- (void)setUserInteractionStateForCenterViewController:(BOOL)state {
// disable user interaction on the current stack of view controllers if the menu is visible
if([self.centerViewController respondsToSelector:@selector(viewControllers)]) {
NSArray *viewControllers = [self.centerViewController viewControllers];
for(UIViewController* viewController in viewControllers) {
viewController.view.userInteractionEnabled = (self.menuState == MFSideMenuStateClosed);
viewController.view.userInteractionEnabled = state;
}
}
}



#pragma mark -
#pragma mark - Center View Controller Movement

Expand Down
1 change: 1 addition & 0 deletions MFSideMenu/MFSideMenuShadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface MFSideMenuShadow : NSObject

Expand Down