zoukankan      html  css  js  c++  java
  • 搜索框,导航栏随页面滑动渐变

    简单的变化

    #pragma mark - scrollViewDelegate
    - (void)scrollViewDidScroll:(UIScrollView *)scrollView
    {
        CGFloat alpha = scrollView.contentOffset.y / 100;
        if (alpha >= 1) {
            alpha = 1;
        }else if (alpha <= 0)
        {
            alpha = 0;
        }
        self.naviView.backgroundColor = [UIcolor colorWithAlphaComponent:alpha];
    }

    //一些更多的变化

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
        if (scrollView == self.myTableView) {
            if (scrollView.contentOffset.y<(200-_homeView.mj_h)){
                float alpha = scrollView.contentOffset.y/(200-_homeView.mj_h);
                _homeView.backgroundColor = [[UIColor whiteColor]colorWithAlphaComponent:alpha];
                if (alpha>0.5) {
                    if(!CGColorEqualToColor(self.titleView.backgroundColor.CGColor, [UIColor colorHexString:@"#efefef"].CGColor)){
                        [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
                        self.telButton.buttonImageView.image = [UIImage imageNamed:@"sy_kf_hei_icon"];
                        self.telButton.titleLabel.textColor = [UIColor colorHexString:@"#3d3d3d"];
                        self.titleView.backgroundColor = [UIColor colorHexString:@"#efefef"];
                        self.messageLabel.textColor = [UIColor colorHexString:@"#3d3d3d"];
                        [self.messageButtonItem setImage:[UIImage imageNamed:@"zjwd_db_ssk_xx_icon"] forState:UIControlStateNormal];
                    }
                }
                else{
                    if(!CGColorEqualToColor(self.titleView.backgroundColor.CGColor, [UIColor whiteColor].CGColor)){
                        [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
                        self.telButton.buttonImageView.image = [UIImage imageNamed:@"sy_kf_bai_icon"];
                        self.telButton.titleLabel.textColor = [UIColor colorHexString:@"#ffffff"];
                        self.titleView.backgroundColor = [UIColor whiteColor];
                        self.messageLabel.textColor = [UIColor colorHexString:@"#ffffff"];
                        [self.messageButtonItem setImage:[UIImage imageNamed:@"sy_xx_bai_icon"] forState:UIControlStateNormal];
                    }
                }
                
            }
            else
            {
                _homeView.backgroundColor = [[UIColor whiteColor]colorWithAlphaComponent:1.0f];
                if(!CGColorEqualToColor(self.titleView.backgroundColor.CGColor, [UIColor colorHexString:@"#efefef"].CGColor)){
                    [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
                    self.telButton.buttonImageView.image = [UIImage imageNamed:@"sy_kf_hei_icon"];
                    self.telButton.titleLabel.textColor = [UIColor colorHexString:@"#3d3d3d"];
                    self.titleView.backgroundColor = [UIColor colorHexString:@"#efefef"];
                    self.messageLabel.textColor = [UIColor colorHexString:@"#3d3d3d"];
                    [self.messageButtonItem setImage:[UIImage imageNamed:@"zjwd_db_ssk_xx_icon"] forState:UIControlStateNormal];
                }
            }
        }
    }
  • 相关阅读:
    用Processing生成屏保(二)
    NTFS文件系统
    用processing生成屏保程序
    用processing画李萨如曲线
    processing模拟三角级数合成方波过程
    express 设置 cookie 以及 httpOnly
    vue 使用 axios 时 post 请求方法传参无法发送至后台
    微信小程序访问后台出现 对应的服务器证书无效。控制台输入 showRequestInfo() 可以获取更详细信息。
    微信长按识别二维码,在 vue 项目中的实现
    vue-cli 构建的 Vue 项目用 localhost 加 端口 能访问,但是切换到 ip 加 端口 就不能访问
  • 原文地址:https://www.cnblogs.com/OIMM/p/9013002.html
Copyright © 2011-2022 走看看