TableView上滑或者下滑实现头视图或者尾视图方法缩小

2016-05-18  本文已影响43人  吞风吻雨葬落日未曾彷徨
self.footImageView.contentMode = UIViewContentModeScaleToFill;
self.footImageView.clipsToBounds = YES;
  _initalFrame = _footImageView.frame;
  _defaultViewHight = _initalFrame.size.height;
- (void)scrollViewDidScroll:(UIScrollView*)scrollView {
    scrollView.backgroundColor = [self replaceStringToUIColor:self.carouselModel.bgcolor];
// 滑动的总区域
    CGFloat ht = scrollView.contentSize.height  - self.tableView.frame.size.height; 
    if (scrollView.contentOffset.y >= ht) {
        CGFloat offsetY = scrollView.contentOffset.y - ht;
        _initalFrame.origin.y = screenHeight - 200 + 50 + 15 + offsetY/1.5; // footView在背景视图的高度
        _initalFrame.origin.x =  -offsetY / 2;
        _initalFrame.size.width = screenWidth  + offsetY;
        _initalFrame.size.height = 200 + offsetY / 1.5;
        _footImageView.frame = _initalFrame;
    }
}
上一篇 下一篇

猜你喜欢

热点阅读