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

Custom background color #71

Open
wants to merge 4 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: 1 addition & 0 deletions MTStatusBarOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ typedef enum MTMessageType {
// the delegate of the overlay
@property (nonatomic, unsafe_unretained) id<MTStatusBarOverlayDelegate> delegate;
@property(nonatomic, strong) UIColor *customTextColor;
@property(nonatomic, strong) UIColor *customBackgroundColor;
//===========================================================
#pragma mark -
#pragma mark Class Methods
Expand Down
32 changes: 21 additions & 11 deletions MTStatusBarOverlay.m
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ - (UIViewController *)rootViewController {
////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark Status Bar Appearance
////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////
- (void)addSubviewToBackgroundView:(UIView *)view {
view.userInteractionEnabled = NO;
[self.backgroundView addSubview:view];
Expand Down Expand Up @@ -1189,13 +1188,18 @@ - (void)setStatusBarBackgroundForStyle:(UIStatusBarStyle)style {
// gray status bar?
// on iPad the Default Status Bar Style is black too
if (style == UIStatusBarStyleDefault && !IsIPad && !IsIPhoneEmulationMode) {
// choose image depending on size
if (self.shrinked) {
self.statusBarBackgroundImageView.image = [self.defaultStatusBarImageShrinked stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
} else {
self.statusBarBackgroundImageView.image = [self.defaultStatusBarImage stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
}
statusBarBackgroundImageView_.backgroundColor = [UIColor clearColor];
if (self.customBackgroundColor) {
statusBarBackgroundImageView_.backgroundColor = self.customBackgroundColor;
}
else
{
// choose image depending on size
if (self.shrinked) {
self.statusBarBackgroundImageView.image = [self.defaultStatusBarImageShrinked stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
} else {
self.statusBarBackgroundImageView.image = [self.defaultStatusBarImage stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
}
}
}
// black status bar? -> no image
else {
Expand Down Expand Up @@ -1247,8 +1251,14 @@ - (void)setColorSchemeForStatusBarStyle:(UIStatusBarStyle)style messageType:(MTM
self.historyTableView.separatorColor = kLightThemeDetailViewBorderColor;
self.detailTextView.textColor = kLightThemeHistoryTextColor;

self.progressView.backgroundColor = [UIColor clearColor];
self.progressView.image = [self.defaultStatusBarImageShrinked stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
if (self.customBackgroundColor) {
self.progressView.backgroundColor = self.customBackgroundColor;
self.progressView.image = nil;
}
else {
self.progressView.backgroundColor = [UIColor clearColor];
self.progressView.image = [self.defaultStatusBarImageShrinked stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
}
} else {
// set color of labels depending on messageType
switch(messageType) {
Expand Down