Skip to content

Add Table animation #21

Description

@Morbix

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
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions