Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileZXLee committed May 29, 2020
2 parents 5e26c5e + 22a04a2 commit 962c572
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pod 'ZXNavigationBar'


#### 【重要】关于自定义导航栏view内容无法自动下移的处理方式
* 如果是系统的导航栏,view的内容会自动下移,如64像素
* 如果是系统的导航栏,view的内容会自动下移,如下移64像素
* 设置了自定义的导航栏,它实际上就是普通的View,则view中的内容不会自动下移以避免挡住导航栏
* `ZXNavigationBar`的处理方法是:
* 如果您是通过frame或者Masonry设置控件布局,请设置y距离顶部高度为导航栏高度,可直接使用`ZXNavBarHeight`这个宏
Expand All @@ -89,6 +89,7 @@ pod 'ZXNavigationBar'
self.zx_isEnableSafeArea = NO;
```
### 导航栏设置
#### 注意:以下设置均在控制器中进行,self代表当前控制器(当前控制器需继承于`ZXNavigationBarController`)
#### 设置导航栏标题
```objective-c
self.title = @"ZXNavigationBar";
Expand Down Expand Up @@ -243,6 +244,18 @@ self.zx_navEnableSmoothFromSystemNavBar = YES;
```objective-c
self.zx_disableNavAutoSafeLayout = YES;
```

#### 自动将顶部View约束下移导航栏高度时的回调,可拦截并自定义下移距离(从xib加载控制器view时生效)
```objective-c
//oldNavOffset:视图在xib中所设置的约束与顶部距离
//currentNavOffset:即将设置的视图与顶部的距离
//返回值为当前需要自定义设置的视图与控制器顶部的距离
self.zx_handleAdjustNavContainerOffsetBlock = ^CGFloat(CGFloat oldNavOffset, CGFloat currentNavOffset) {
//此设置代表从xib加载控制器view时,控制器view中的内容距离控制器顶部10像素(默认距离顶部为导航栏高度)
return 10;
};
```

#### 自定义TitleView
```objective-c
//创建自定义View
Expand All @@ -258,9 +271,9 @@ UIView *customNav = [[UIView alloc]init];

#### 拦截侧滑返回手势和返回按钮点击事件
```objective-c
//创建自定义View
//拦截侧滑返回手势和返回按钮点击事件
self.zx_handlePopBlock = ^BOOL(ZXNavigationBarController * _Nonnull viewController, ZXNavPopBlockFrom popBlockFrom) {
//viewController:当前控制
//viewController:当前控制器
//popBlockFrom:通过什么方式(点击返回按钮或侧滑返回手势)触发pop操作

//doSomething
Expand Down

0 comments on commit 962c572

Please # to comment.