//状态栏透明
self.automaticallyAdjustsScrollViewInsets = NO;
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];
}
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];
}
}