From 1869282d7efc5a7ebfd11b8feaebf4f00c24f43a Mon Sep 17 00:00:00 2001 From: Barry Date: Mon, 4 May 2020 18:07:16 +0800 Subject: [PATCH] Lower windowLevel only when windowLevel equals UIWindowLevelStatusBar --- ABVolumeControl/Classes/ABVolumeControl.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ABVolumeControl/Classes/ABVolumeControl.m b/ABVolumeControl/Classes/ABVolumeControl.m index b2e413a..473e817 100644 --- a/ABVolumeControl/Classes/ABVolumeControl.m +++ b/ABVolumeControl/Classes/ABVolumeControl.m @@ -43,13 +43,17 @@ - (void) setVolumeControlStyle:(ABVolumeControlStyle)volumeControlStyle { _volumeControlStyle = volumeControlStyle; if ([self notNull:self.volumeBar]) { - self.volumeBar.window.windowLevel = UIWindowLevelStatusBar-1; + if (self.volumeBar.window.windowLevel == UIWindowLevelStatusBar) { + self.volumeBar.window.windowLevel--; + } [self.volumeBar removeFromSuperview]; self.volumeBar = nil; } if ([self notNull:self.volumeBackground]) { - self.volumeBackground.window.windowLevel = UIWindowLevelStatusBar-1; + if (self.volumeBackground.window.windowLevel == UIWindowLevelStatusBar) { + self.volumeBackground.window.windowLevel--; + } [self.volumeBackground removeFromSuperview]; self.volumeBackground = nil; }