From 963e29e8b5c66d6383b9ed62445a25760d9475fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ko=C5=82ek?= Date: Tue, 1 Sep 2015 13:10:01 +0200 Subject: [PATCH] allow hiding and changing the background overlay opacity --- src/Components/MRProgressOverlayView.h | 6 ++++++ src/Components/MRProgressOverlayView.m | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Components/MRProgressOverlayView.h b/src/Components/MRProgressOverlayView.h index 578dc3d..0a2ce5c 100644 --- a/src/Components/MRProgressOverlayView.h +++ b/src/Components/MRProgressOverlayView.h @@ -191,6 +191,12 @@ typedef NS_ENUM(NSUInteger, MRProgressOverlayViewMode){ */ @property (nonatomic, copy) MRProgressOverlayViewStopBlock stopBlock; +/** Setting this value to YES will prevent backgroundColor change when displaying the Overlay */ +@property (nonatomic, assign) BOOL shouldHideBackgroundMask; + +/** Background Color Opacity */ +@property (nonatomic, assign) float backgroundMaskOpacity; + /** Change the tint color of the mode views. diff --git a/src/Components/MRProgressOverlayView.m b/src/Components/MRProgressOverlayView.m index d20b482..9d134ba 100644 --- a/src/Components/MRProgressOverlayView.m +++ b/src/Components/MRProgressOverlayView.m @@ -180,6 +180,9 @@ - (void)commonInit { // Create blurView self.blurView = [self createBlurView]; + self.shouldHideBackgroundMask = NO; + self.backgroundMaskOpacity = 0.4f; + // Create container with contents UIView *dialogView = [UIView new]; [self addSubview:dialogView]; @@ -566,7 +569,9 @@ - (void)show:(BOOL)animated { void(^animBlock)() = ^{ [self setSubviewTransform:CGAffineTransformIdentity alpha:1.0f]; - self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4f]; + if (!self.shouldHideBackgroundMask) { + self.backgroundColor = [UIColor colorWithWhite:0 alpha:self.backgroundMaskOpacity]; + } }; if (animated) {