- (void)scrollViewDidScroll:(UIScrollView*)scrollView{
/*
CGRect frame = scrollView.frame;
frame.origin.y = frame.origin.y - scrollView.contentOffset.y;
NSLog(@"scrollView.contentOffset.y = %.2f, frame.origin.y = %.2f, scrollView.bounds.origin.y = %.2f", scrollView.contentOffset.y, frame.origin.y,scrollView.bounds.origin.y);
// 1.contentOffset.y 向上滑为正 ,向下滑为负; 2.frame.origin.y 为scrollView的原点y坐标,向上滑减小,向下滑增加 3.scrollView.bounds.origin.y 和 contentOffset.y值相同
*/
CGFloat height = 100 ;//tableView上面的View高度
CGRectaOriginRect = scrollView.frame;
aOriginRect.origin.y= aOriginRect.origin.y- scrollView.contentOffset.y;//tableView当前的y坐标
if(aOriginRect.origin.y<= height+LL_StatusBarAndNavigationBarHeight && aOriginRect.origin.y>=0){//向上滑,但scrollView没滚动出View
CGRectaOriginBounds = scrollView.bounds;
aOriginBounds.origin=CGPointMake(0,0);
scrollView.bounds= aOriginBounds;
}
else if (aOriginRect.origin.y > height+ LL_StatusBarAndNavigationBarHeight ){//向下滑
aOriginRect.origin.y= height +LL_StatusBarAndNavigationBarHeight;
}
else{
aOriginRect.origin.y=0;//向上滑,且scrollView滚动出View
}
CGSizescreenSize = [[UIScreenmainScreen]bounds].size;
aOriginRect.size.height= screenSize.height- aOriginRect.origin.y;
scrollView.frame= aOriginRect;
self.titleView.frame = CGRectMake(self.titleView.frame.origin.x, scrollView.frame.origin.y - height, self.titleView.frame.size.width, self.titleView.frame.size.height);
}