diff --git a/REFrostedViewController/REFrostedContainerViewController.m b/REFrostedViewController/REFrostedContainerViewController.m index 6830fb8..63d61aa 100644 --- a/REFrostedViewController/REFrostedContainerViewController.m +++ b/REFrostedViewController/REFrostedContainerViewController.m @@ -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]; diff --git a/REFrostedViewController/REFrostedViewController.h b/REFrostedViewController/REFrostedViewController.h index e01ffa8..c3c9723 100644 --- a/REFrostedViewController/REFrostedViewController.h +++ b/REFrostedViewController/REFrostedViewController.h @@ -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 diff --git a/REFrostedViewController/REFrostedViewController.m b/REFrostedViewController/REFrostedViewController.m index 3087448..4e2e0f3 100644 --- a/REFrostedViewController/REFrostedViewController.m +++ b/REFrostedViewController/REFrostedViewController.m @@ -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; }