1.设置导航栏的隐藏
[self.navigationController setNavigationBarHidden:YES animated:animated];
self.navigationController.navigationBarHidden = YES;
这两种方法的区别:
// Hide or show the navigation bar. If animated, it will transition vertically using UINavigationControllerHideShowBarDuration.
隐藏或显示导航栏。如果已设置动画,它将使用UINavigationControllerHideShowBarDuration垂直过渡。
2.UIToolbar
self.navigationController.toolbarHidden = YES;
[self.navigationController setToolbarHidden:NO animated:YES];//隐藏工具栏(下面)默认是YES(隐藏的)
3.设置导航栏的包含的控制器
viewControllers
- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); // If animated is YES, then simulate a push or pop depending on whether the new top view controller was previously in the stack.
4.代理
导航栏显示
@property(nullable, nonatomic, weak) id<UINavigationControllerDelegate> delegate;
导航栏手势,全局侧滑
@property(nullable, nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer NS_AVAILABLE_IOS(7_0) __TVOS_PROHIBITED;
5.UINavigationBar
5.1.导航栏是否模糊处理,默认是YES
self.navigationController.navigationBar.translucent = NO;
YES是透明效果并且主view不会偏移 NO是导航栏不透明 主view会向下偏移64px
5.2 UINavigationBarDelegate
item的点击事件(拦截)
5.3 backIndicatorImage;backIndicatorTransitionMaskImage:返回按钮的图标
后退指示灯图像显示在后退按钮旁边。
在“推送”和“弹出”转换期间,后指示器转换蒙版图像用作内容的蒙版。
注意:如果要自定义后指示器图像,必须同时设置这两个属性。
5.4 tintColor/barTintColor
iOS 7.0上的条形图的TintColor行为已更改。它不再影响Bar的背景
并按照添加到uiview的TintColor属性的说明进行操作。
要为条形图的背景着色,请使用-bartintcolor。
网友评论