Last active
September 6, 2016 13:32
-
-
Save odrobnik/0e3d4b51e7b29fa9a874cc013cebd86e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) | |
{ | |
if editingStyle == .Delete | |
{ | |
tableView.subviews.forEach({ (subview) in | |
if let subview = subview as? TableSectionFooterView | |
{ | |
subview.setNeedsLayout() | |
subview.limitMovementToUpwards = true | |
} | |
}) | |
removeListItem(at: indexPath) | |
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) | |
tableView.subviews.forEach({ (subview) in | |
if let subview = subview as? TableSectionFooterView | |
{ | |
subview.setNeedsLayout() | |
subview.limitMovementToUpwards = false | |
} | |
}) | |
UIView.animateWithDuration(0.20, delay: 0, options: [.BeginFromCurrentState, .CurveLinear], animations: { | |
tableView.setNeedsLayout() | |
tableView.layoutIfNeeded() | |
}, completion: nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment