//设置页面有上拉手势的时候隐藏导航栏,快速下拉则显示导航栏
self.navigationController.hidesBarsOnSwipe = YES;
//设置页面有单击事件的时候隐藏导航栏,再次点击显示导航栏
self.navigationController.hidesBarsOnTap = YES;
//这两个设置会影响navigationController中的所有控制器,所以在不用的时候要设置为NO;
//隐藏导航栏
1.self.navigationController.navigationBar.hidden = YES;
2.self.navigationController.navigationBarHidden = YES;
//第二种隐藏会使右滑pop手势失效,解决方案
self.navigationController.interactivePopGestureRecognizer.delegate = self;
#pragma mark - <UIGestureRecognizerDelegate>
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
return YES;
}
//消除navigationBar底部的分割线
1.设置空图片
[self.navigationBar setShadowImage:[UIImage new]];
2.删除shadowImage
for (UIView *sub in self.navigationBar.subviews) {
if ([sub isKindOfClass:[UIImageView class]]) {
[[sub.subviews firstObject]removeFromSuperview];
}
}
navigationController
最新推荐文章于 2024-02-01 07:15:00 发布