Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Animate the Table cells

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 533
    Comment on it


    Hi Readers,


    To make the tableView cell animate from a particular point to its position, you just have to add the lines below in the willDisplayCell: delegate function of the table view as shown below.


    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{          
    

    1.Below we Setup the CATransform3D structure


        CATransform3D rotation;
    
        rotation = CATransform3DMakeRotation( (90*M_PI)/180, 0.0, 0.7, 0.4);
    
        rotation.m34 = 1.0/ -600;    
    

    2.Below is the code which defines the initial state


        cell.layer.shadowColor = [[UIColor blackColor]CGColor];
    
        cell.layer.shadowOffset = CGSizeMake(10, 10);
    
        cell.alpha = 0;    
    
        cell.layer.transform = rotation;
    
        cell.layer.anchorPoint = CGPointMake(0, 0.5);
    

    3. Below we Define the final state (After the animation) and commit the animation so that the initial property of table exists


        [UIView beginAnimations:@"rotation" context:NULL];
    
        [UIView setAnimationDuration:6];
    
        cell.layer.transform = CATransform3DIdentity;
    
        cell.alpha = 1;
    
        cell.layer.shadowOffset = CGSizeMake(0, 0);
    
        [UIView commitAnimations];
    
        }
    

    Thanks for reading

    Keep Coding ..:)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: