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

/*隐藏状态栏时设置以下属性 要不然界面视图坐标距离偏移*/ 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]; }

你可能感兴趣的:(隐藏状态栏时要设置几个属性)