#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];
}
}];
}
03-17