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

Enable interaction while the MenuViewController is presented #143

Open
wants to merge 2 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
8 changes: 7 additions & 1 deletion REFrostedViewController/REFrostedContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ - (void)viewDidLoad
self.backgroundViews = [NSMutableArray array];
for (NSInteger i = 0; i < 4; i++) {
UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectNull];
backgroundView.backgroundColor = [UIColor blackColor];

if (self.frostedViewController.interactionWhileMenuIsPresentedShouldBeEnabled) {
backgroundView.backgroundColor = [UIColor clearColor];
} else {
backgroundView.backgroundColor = [UIColor blackColor];
}

backgroundView.alpha = 0.0f;
[self.view addSubview:backgroundView];
[self.backgroundViews addObject:backgroundView];
Expand Down
1 change: 1 addition & 0 deletions REFrostedViewController/REFrostedViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef NS_ENUM(NSInteger, REFrostedViewControllerLiveBackgroundStyle) {
@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
@property (assign, readwrite, nonatomic) BOOL limitMenuViewSize;
@property (assign, readwrite, nonatomic) CGSize menuViewSize;
@property (assign, readwrite, nonatomic) BOOL interactionWhileMenuIsPresentedShouldBeEnabled;
@property (assign, readwrite, nonatomic) BOOL liveBlur; // iOS 7 only
@property (assign, readwrite, nonatomic) REFrostedViewControllerLiveBackgroundStyle liveBlurBackgroundStyle; // iOS 7 only

Expand Down
24 changes: 23 additions & 1 deletion REFrostedViewController/REFrostedViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,29 @@ - (void)presentMenuViewControllerWithAnimatedApperance:(BOOL)animateApperance
self.containerViewController.screenshotImage = [[self.contentViewController.view re_screenshot] re_applyBlurWithRadius:self.blurRadius tintColor:self.blurTintColor saturationDeltaFactor:self.blurSaturationDeltaFactor maskImage:nil];
}

[self re_displayController:self.containerViewController frame:self.contentViewController.view.frame];

if (self.interactionWhileMenuIsPresentedShouldBeEnabled) {
if (self.direction == REFrostedViewControllerDirectionLeft) {
[self re_displayController:self.containerViewController frame:CGRectMake(self.contentViewController.view.frame.origin.x, self.contentViewController.view.frame.origin.y, self.menuViewSize.width, self.menuViewSize.height)];
}

if (self.direction == REFrostedViewControllerDirectionRight) {
[self re_displayController:self.containerViewController frame:CGRectMake(self.contentViewController.view.frame.size.width - self.menuViewSize.width, self.contentViewController.view.frame.origin.y, self.menuViewSize.width, self.menuViewSize.height)];
}

if (self.direction == REFrostedViewControllerDirectionTop) {
[self re_displayController:self.containerViewController frame:CGRectMake(self.contentViewController.view.frame.origin.x, self.contentViewController.view.frame.origin.y, self.menuViewSize.width, self.menuViewSize.height)];
}

if (self.direction == REFrostedViewControllerDirectionBottom) {
[self re_displayController:self.containerViewController frame:CGRectMake(self.contentViewController.view.frame.origin.x, self.contentViewController.view.frame.size.height - self.menuViewSize.height, self.menuViewSize.width, self.menuViewSize.height)];
}
} else {
[self re_displayController:self.containerViewController frame:self.contentViewController.view.frame];
}



self.visible = YES;
}

Expand Down