复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44#define NAVBAR_COLORCHANGE_POINT (IMAGE_HEIGHT - NAV_HEIGHT*2) #define IMAGE_HEIGHT 280 #define NAV_HEIGHT 64 #pragma mark 导航渐变 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat offsetY = scrollView.contentOffset.y; if (offsetY > NAVBAR_COLORCHANGE_POINT) { [self changeNavBarAnimateWithIsClear:NO]; self.title = @"视频"; } else { [self changeNavBarAnimateWithIsClear:YES]; self.title = @""; } } - (void)changeNavBarAnimateWithIsClear:(BOOL)isClear { __weak typeof(self) weakSelf = self; [UIView animateWithDuration:0.6 animations:^ { __strong typeof(self) pThis = weakSelf; if (isClear == YES) { pThis.navigationController.navigationBar.alpha=0.6; [pThis.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"millcolorGrad"] forBarMetrics:UIBarMetricsDefault]; } else { pThis.navigationController.navigationBar.alpha=1; [pThis.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"millcolorGrad"] forBarMetrics:UIBarMetricsDefault]; } }]; }
最后
以上就是老迟到云朵最近收集整理的关于ios 导航渐变的全部内容,更多相关ios内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复