Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Table animation #21

Open
Morbix opened this issue Aug 19, 2016 · 0 comments
Open

Add Table animation #21

Morbix opened this issue Aug 19, 2016 · 0 comments

Comments

@Morbix
Copy link
Member

Morbix commented Aug 19, 2016

Fix this code and add this animations:

func animateTable(tableView: UITableView) {
        tableView.reloadData()

        let cells = tableView.visibleCells
        let tableHeight: CGFloat = tableView.bounds.size.height

        for i in cells {
            let cell: UITableViewCell = i 
            cell.transform = CGAffineTransformMakeTranslation(0, tableHeight)
        }

        var index = 0

        for a in cells {
            let cell: UITableViewCell = a 
            UIView.animateWithDuration(1.5, delay: 0.05 * Double(index), usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: {
                cell.transform = CGAffineTransformMakeTranslation(0, 0);
                }, completion: nil)

            index += 1
        }
    }

    func animateXCellTableView(tableView: UITableView) {
        tableView.reloadData()

        let cells = tableView.visibleCells

        for i in cells {
            let cell: UITableViewCell = i 
            cell.frame.origin.x = tableView.frame.width
        }

        var index = 0

        for a in cells {
            let cell: UITableViewCell = a 
            UIView.animateWithDuration(1.0, delay: 0.05 * Double(index), usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: {
                cell.frame.origin.x = 0
                }, completion: nil)

            index += 1
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant