Last active
August 29, 2015 14:22
-
-
Save markjulmar/b5c69fd289daaa4aafbe to your computer and use it in GitHub Desktop.
Fancy UITableViewCell animations
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
// To get some fancy animation for your UITableViewCells | |
// (converted from ObjC code found at http://www.thinkandbuild.it/animating-uitableview-cells/): | |
// Put this into the UITableViewDelegate | |
public override void WillDisplay (UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) | |
{ | |
CATransform3D rotation = CATransform3D.MakeRotation( (90.0f*(float)Math.PI)/180f, 0.0f, 0.7f, 0.4f); | |
rotation.m34 = 1.0f/ -600f; | |
cell.Layer.ShadowColor = UIColor.Black.CGColor; | |
cell.Layer.ShadowOffset = new SizeF (10, 10); | |
cell.Alpha = 0; | |
cell.Layer.Transform = rotation; | |
cell.Layer.AnchorPoint = new PointF (0f, 0.5f); | |
UIView.BeginAnimations ("rotation"); | |
UIView.SetAnimationDuration (0.8); | |
cell.Layer.Transform = CATransform3D.Identity; | |
cell.Alpha = 1; | |
cell.Layer.ShadowOffset = new SizeF (0, 0); | |
UIView.CommitAnimations (); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment