Last active
October 13, 2016 16:26
-
-
Save mschmulen/9c8434f957701ae83d7f62ce418a6222 to your computer and use it in GitHub Desktop.
animate cell
This file contains 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
// If you wanted to smooth in the animation of the tableview cell you can do something like this ... | |
extension SomeTableViewCell : AnimatedTableViewCellProtocol { | |
func startAnimation() { | |
//this scales but it could alpha in as well | |
self.layer.transform = CATransform3DMakeScale(0.75,0.75,1) | |
UIView.animateWithDuration(0.20, animations: { | |
self.layer.transform = CATransform3DMakeScale(1,1,1) | |
}) | |
} | |
} | |
// and add the delegate method to call it. | |
extension SomeTableViewController : UITableViewDelegate { | |
public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
if let atvc:AnimatedTableViewCellProtocol = cell as? AnimatedTableViewCellProtocol { | |
atvc.startAnimation() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment