导航渐渐隐藏
#pragma mark - scrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView*)scrollView
{
// 100开始显示
// 180显示完全
CGFloatoffsetY = scrollView.contentOffset.y;
CGFloatalpha =0;
NSLog(@"offsetY::%f",offsetY);
NSLog(@"");
if(offsetY >NAVBAR_CHANGE_POINT) {
alpha =MIN(1,1- ((NAVBAR_CHANGE_POINT+64- offsetY) /64));
}
if(alpha>0) {
[self.navigationItem.titleViewsetHidden:NO];
[self.navigationItem.leftBarButtonItem.customViewsetHidden:NO];
[self.navigationItem.rightBarButtonItem.customViewsetHidden:NO];
}
else
{
NSLog(@"等于0...");
}
[self.navigationController.navigationBarlt_setBackgroundColor:[BTGobalRedColorcolorWithAlphaComponent:alpha]];
[self.navigationItem.titleViewsetAlpha:alpha];
[self.navigationItem.leftBarButtonItem.customViewsetAlpha:alpha];
[self.navigationItem.rightBarButtonItem.customViewsetAlpha:alpha];
self.navigationBarAlpha= alpha;
}
下拉顶部图片放大
CGFloatoffsetY = scrollView.contentOffset.y;
CGFloatalpha =0.0f;
if(offsetY <0) {
CGFloatfactor =ABS(offsetY) +200;
CGFloatw =kScreen_Width* factor/200;
CGFloatx = - (w-kScreen_Width) *0.5;
CGFloaty = -ABS(offsetY);
CGFloath = factor;
CGRectframe =CGRectMake(x,y,w,h);
self.headerView.imageView.frame= frame;
}
中间停留:
- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section
{
NSLog(@"%ld",section);
BTSubjectSectionView* sectionView = [BTSubjectSectionViewsectionView];
sectionView.titleArray=@[@"半糖精选",@"用户推荐"];
sectionView.delegate=self;
returnsectionView;
}
- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
{
return44;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView
{
return1;
}