diff --git a/MTStatusBarOverlay.h b/MTStatusBarOverlay.h index 5a7ca0b..da927ed 100755 --- a/MTStatusBarOverlay.h +++ b/MTStatusBarOverlay.h @@ -116,7 +116,8 @@ typedef enum MTMessageType { @property (nonatomic, copy) NSString *detailText; // the delegate of the overlay @property (nonatomic, unsafe_unretained) id delegate; - +// default is what the app sets +@property(nonatomic) UIStatusBarStyle statusBarStyle; //=========================================================== #pragma mark - diff --git a/MTStatusBarOverlay.m b/MTStatusBarOverlay.m index 884bc2e..43f950c 100755 --- a/MTStatusBarOverlay.m +++ b/MTStatusBarOverlay.m @@ -279,6 +279,8 @@ @implementation MTStatusBarOverlay - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { + self.statusBarStyle = [UIApplication sharedApplication].statusBarStyle; + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; // only use height of 20px even is status bar is doubled @@ -673,7 +675,7 @@ - (void)showNextMessage { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(clearHistory) object:nil]; // update UI depending on current status bar style - UIStatusBarStyle statusBarStyle = [UIApplication sharedApplication].statusBarStyle; + UIStatusBarStyle statusBarStyle = self.statusBarStyle; [self setStatusBarBackgroundForStyle:statusBarStyle]; [self setColorSchemeForStatusBarStyle:statusBarStyle messageType:messageType]; [self updateUIForMessageType:messageType duration:duration]; @@ -991,7 +993,7 @@ - (void)setShrinked:(BOOL)shrinked animated:(BOOL)animated { } // update status bar background - [self setStatusBarBackgroundForStyle:[UIApplication sharedApplication].statusBarStyle]; + [self setStatusBarBackgroundForStyle:self.statusBarStyle]; }]; } @@ -1072,10 +1074,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID]; cell.textLabel.font = [UIFont boldSystemFontOfSize:10]; - cell.textLabel.textColor = [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault ? kLightThemeHistoryTextColor : kDarkThemeHistoryTextColor; + cell.textLabel.textColor = self.statusBarStyle == UIStatusBarStyleDefault ? kLightThemeHistoryTextColor : kDarkThemeHistoryTextColor; cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:12]; - cell.detailTextLabel.textColor = [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault ? kLightThemeHistoryTextColor : kDarkThemeHistoryTextColor; + cell.detailTextLabel.textColor = self.statusBarStyle == UIStatusBarStyleDefault ? kLightThemeHistoryTextColor : kDarkThemeHistoryTextColor; } // step 3: set up cell value