隐藏 iOS 状态栏的文本



这个问题不是关于隐藏状态栏,而只是隐藏状态栏的文本。

我在任何地方都找不到解决这个问题的方法

UBER应用程序做到了这一点,当我们在UBER中打开侧菜单时,状态栏text消失,

不可以隐藏status bartext。你可以用动画隐藏状态栏,比如

  CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
[UIView animateWithDuration:0.7 animations:^{
     [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
 //   self.navigationController.navigationBar.frame = self.navigationController.navigationBar.bounds;
    self.view.window.frame = CGRectMake(0, 0, appFrame.size.width, appFrame.size.height);
}];

它在obj c中,只是为了理解概念,请在swift中转换!

您可以添加新视图而不是状态栏,因为自定义状态栏看起来像

希望这将有所帮助:)

int itemToHide = 0;
[[objc_getClass("SBStatusBarStateAggregator") sharedInstance]                  
beginCoalescentBlock];
[[objc_getClass("SBStatusBarStateAggregator") sharedInstance]
_setItem:itemToHide enabled:NO];
[[objc_getClass("SBStatusBarStateAggregator") sharedInstance]     
endCoalescentBlock];

请查看此链接。它可能对你有帮助。

最新更新