简体   繁体   中英

Zoom in/out on swiping tableView Animation

I want to achieve this animation:

Here is the Gif: http://imgur.com/4TZIbwp

Since the content is dynamic, I'm using tableView to populate the data. I've tried scrollViewDidScroll delegate methods to change the constraints but it's not helping me. I've even tried swipe gesture, but still can't manage to achieve this.

Can anyone provide a knowledge, a bit of code for getting this animation.

I have tried to tackle your issue in this project.

The flaw with this solution is that it requires an unattractive inset at the top of the table view to translate the offset into a meaningful variable with which to shrink the table view.

The relevant code in the project is within the scroll delegate function:

func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let yOffset = min(0.0, max(-maximumOffset, scrollView.contentOffset.y))
        let constant = -yOffset
        topTableViewConstraint.constant = constant
        leadingTableViewConstraint.constant = constant / 5.0
        trailingTableViewConstraint.constant = constant / 5.0
        view.layoutIfNeeded()
    }

I am sorry that I cannot be more helpful, or provide you with a final solution.

Hopefully the project will aid you in find that answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM