Giter VIP home page Giter VIP logo

Comments (3)

liangdrime avatar liangdrime commented on May 16, 2024

这个通常需要考虑交互,我研究一下。回头给你回复

from swipetableview.

songzhiming avatar songzhiming commented on May 16, 2024

麻烦了。

from swipetableview.

liangdrime avatar liangdrime commented on May 16, 2024

这个功能已经解决,在点击header的时候,对当前item的offset与inset(或者tableHeaderView的height进行调整),具体代码如下

// tap to change header's frame
- (void)tapHeader:(UITapGestureRecognizer *)tap {

    CGFloat changeHeight = 50; // or -50, it will be parallax.
    UIScrollView * currentItem = _swipeTableView.currentItemView;
#if !defined(ST_PULLTOREFRESH_HEADER_HEIGHT)
    CGPoint contentOffset = currentItem.contentOffset;
    UIEdgeInsets inset = currentItem.contentInset;
    inset.top += changeHeight;
    contentOffset.y -= changeHeight;  // if you want the header change height from up, not do this.

    NSMutableDictionary * contentOffsetQuene = [self.swipeTableView valueForKey:@"contentOffsetQuene"];
    [contentOffsetQuene removeAllObjects];

    [UIView animateWithDuration:.35f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        _tableViewHeader.st_height += changeHeight;
        currentItem.contentInset = inset;
        currentItem.contentOffset = contentOffset;
    } completion:^(BOOL finished) {
        [self.swipeTableView setValue:@(self.tableViewHeader.st_height) forKey:@"headerInset"];
    }];
#else
    UIView * tableHeaderView = ((UITableView *)currentItem).tableHeaderView;
    tableHeaderView.st_height += changeHeight;

    [UIView animateWithDuration:.35f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        _tableViewHeader.st_height += changeHeight;
        [currentItem setValue:tableHeaderView forKey:@"tableHeaderView"];
    } completion:^(BOOL finished) {
        [self.swipeTableView setValue:@(self.tableViewHeader.st_height) forKey:@"headerInset"];
    }];
#endif

}

示例代码已经提交,并且header中imageview做了调整。可以在demo中替换点击header的tapHeader:方法,运行查看效果

from swipetableview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.