隐藏状态栏时要设置几个属性

2017-03-28  本文已影响47人  af4e8a35bc89

/*隐藏状态栏时设置以下属性 要不然界面视图坐标距离偏移*/ self.edgesForExtendedLayout = UIRectEdgeNone; self.extendedLayoutIncludesOpaqueBars = NO; self.modalPresentationCapturesStatusBarAppearance = NO; self.automaticallyAdjustsScrollViewInsets = NO;

设置完以上属性之后,再设置状态栏的隐藏与显示

if (scrollView.contentOffset.y < -5) { [[UIApplication sharedApplication] setStatusBarHidden:YES]; } if (scrollView.contentOffset.y >= -5) { [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; }

上一篇下一篇

猜你喜欢

热点阅读