导航栏透明度改变

来源:互联网 发布:阿里云os3.2 系统优化 编辑:程序博客网 时间:2024/05/01 20:46

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{

    if (scrollView !=self.MyCollectionDetailsTable) {

        return;

    }

    

    UIColor *color=kUIColorFromRGBWithAlapha(232,91, 85, 1);

    UIColor *color1=[UIColorwhiteColor];

    CGFloat offset=scrollView.contentOffset.y;

    if (offset<0) {

         _RedFocusBtn.layer.borderColor=kUIColorFromRGBWithAlapha(147,147, 147, 1).CGColor;

        [_RedFocusBtnsetTitleColor:kUIColorFromRGBWithAlapha(147,147, 147, 1)forState:UIControlStateNormal];

       [_BackBtnsetImage:[UIImageimageNamed:@"heifanhui"]forState:UIControlStateNormal];

        self.RedView.backgroundColor = [colorcolorWithAlphaComponent:0];

        self.RedTitle.textColor= [color1colorWithAlphaComponent:0];

    }else {

        CGFloat alpha=1-((65*kMainNewScreenScale-offset)/65*kMainNewScreenScale);

        self.RedView.backgroundColor=[colorcolorWithAlphaComponent:alpha];

        self.RedTitle.textColor=[color1colorWithAlphaComponent:alpha];

        _RedFocusBtn.layer.borderColor=[UIColorwhiteColor].CGColor;

        [_RedFocusBtnsetTitleColor:[UIColorwhiteColor] forState:UIControlStateNormal];

        [_BackBtnsetImage:[UIImageimageNamed:@"denglufanhui"]forState:UIControlStateNormal];

    }

}


0 0
原创粉丝点击