滑动的scrollowview的导航渐变

CGFloat offsetY = scrollView.contentOffset.y;

    CGFloat alpha = 0;

    if (offsetY >= 64) {

        alpha=((offsetY-64)/64 <= 1.0 ? (offsetY-64)/64:1);

        [self.navigationController.navigationBar lt_setBackgroundColor:[[UIColor appNavigationBarColor] colorWithAlphaComponent:alpha]];

        

    }else{

        [self.navigationController.navigationBar lt_setBackgroundColor:[UIColor clearColor]];

    }

原文地址:https://www.cnblogs.com/walkingzmz/p/5992152.html