首页 > 其他 > 详细

关于滑动改变Navigation颜色的方法

时间:2016-06-30 14:10:35      阅读:259      评论:0      收藏:0      [点我收藏+]
//状态栏透明
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.statusBarView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 20)];
    self.statusBarView.backgroundColor=[UIColor clearColor];
    [self.view addSubview:self.statusBarView];
 
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSLog(@"offset---scroll:%f",self.tablView.contentOffset.y);
    UIColor *color=[UIColor redColor];
    CGFloat offset=scrollView.contentOffset.y;
    if (offset<0) {
        self.navigationController.navigationBar.backgroundColor = [color colorWithAlphaComponent:0];
        self.statusBarView.backgroundColor = [color colorWithAlphaComponent:0];
    }else {
        CGFloat alpha=1-((64-offset)/64);
        self.navigationController.navigationBar.backgroundColor=[color colorWithAlphaComponent:alpha];
        self.statusBarView.backgroundColor = [color colorWithAlphaComponent:alpha];
       
    }
}

关于滑动改变Navigation颜色的方法

原文:http://www.cnblogs.com/good-morning/p/5629660.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!