Commit c90e2d286fac715670352a2457acb0d134dc700a
1 parent
eff265f3
no message
Showing
1 changed file
with
14 additions
and
11 deletions
CNLiveMineModule/Classes/Controller/CNLiveMineController.m
| @@ -195,16 +195,18 @@ static const NSInteger kHEIGHT = 250; | @@ -195,16 +195,18 @@ static const NSInteger kHEIGHT = 250; | ||
| 195 | } | 195 | } |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | - if (point.y > -200) { | ||
| 199 | - [UIView animateWithDuration:0.25 animations:^{ | ||
| 200 | - self.navigationBar.frame = CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop); | ||
| 201 | - }]; | ||
| 202 | - | ||
| 203 | - } else { | ||
| 204 | - [UIView animateWithDuration:0.25 animations:^{ | ||
| 205 | - self.navigationBar.frame = CGRectMake(0, -NavigationContentTop, SCREEN_WIDTH, NavigationContentTop); | ||
| 206 | - }]; | ||
| 207 | - | 198 | + CGFloat offsetToShow = 50.0;//滑动多少就完全显示 |
| 199 | + | ||
| 200 | + CGFloat offsetY = scrollView.contentOffset.y+kHEIGHT; | ||
| 201 | + if (offsetY <= 0) { | ||
| 202 | + _navigationBar.alpha = 0.0; | ||
| 203 | + } | ||
| 204 | + else if (offsetY > offsetToShow) { | ||
| 205 | + _navigationBar.alpha = 1.0; | ||
| 206 | + } | ||
| 207 | + else { | ||
| 208 | + CGFloat alpha = MIN((offsetY / offsetToShow), 1); | ||
| 209 | + _navigationBar.alpha = alpha; | ||
| 208 | } | 210 | } |
| 209 | 211 | ||
| 210 | } | 212 | } |
| @@ -300,8 +302,9 @@ static const NSInteger kHEIGHT = 250; | @@ -300,8 +302,9 @@ static const NSInteger kHEIGHT = 250; | ||
| 300 | } | 302 | } |
| 301 | - (CNLiveMineNavigationBar *)navigationBar { | 303 | - (CNLiveMineNavigationBar *)navigationBar { |
| 302 | if (!_navigationBar) { | 304 | if (!_navigationBar) { |
| 303 | - _navigationBar = [[CNLiveMineNavigationBar alloc]initWithFrame:CGRectMake(0, -NavigationContentTop, SCREEN_WIDTH, NavigationContentTop)]; | 305 | + _navigationBar = [[CNLiveMineNavigationBar alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; |
| 304 | _navigationBar.backgroundColor = [UIColor colorWithRed:32/255.0 green:31/255.0 blue:36/255.0 alpha:1.0]; | 306 | _navigationBar.backgroundColor = [UIColor colorWithRed:32/255.0 green:31/255.0 blue:36/255.0 alpha:1.0]; |
| 307 | + _navigationBar.alpha = 0.0; | ||
| 305 | } | 308 | } |
| 306 | return _navigationBar; | 309 | return _navigationBar; |
| 307 | } | 310 | } |