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];
                }
            }
        }
    }
  • 相关阅读:
    病毒木马查杀实战第017篇:U盘病毒之专杀工具的编写
    病毒木马查杀实战第016篇:U盘病毒之逆向分析
    病毒木马查杀实战第015篇:U盘病毒之脱壳研究
    病毒木马查杀实战第014篇:U盘病毒之手动查杀
    病毒木马查杀实战第024篇:MBR病毒之编程解析引导区
    病毒木马查杀实战第023篇:MBR病毒之引导区的解析
    缓冲区溢出分析第11课:整数溢出的原理
    缓冲区溢出分析第10课:Winamp缓冲区溢出研究
    Backdoor.Zegost木马病毒分析(一)
    缓冲区溢出分析第09课:MS06-040漏洞研究——深入挖掘
  • 原文地址:https://www.cnblogs.com/OIMM/p/9013002.html
Copyright © 2011-2022 走看看