我是靠谱客的博主 老迟到云朵,最近开发中收集的这篇文章主要介绍ios 导航渐变,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

#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 导航渐变所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部