几种cell动画

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

    if (indexPath.row == 1 && indexPath.section <2) {

        cell.layer.shadowColor = [[UIColor blackColor] CGColor];

        cell.layer.shadowOffset = CGSizeMake(10, 10);

        cell.alpha = 0;

        cell.layer.transform = CATransform3DMakeScale(0.5, -0.15, 1);

        cell.layer.anchorPoint = CGPointMake(0.5, -0.5);

        

        // define final state (e.g. after animation) & commit animation

        [UIView beginAnimations:@"scaleTableViewCellAnimationID" context:NULL];

        [UIView setAnimationDuration:1];

        cell.layer.shadowOffset = CGSizeMake(0, 0);

        cell.alpha = 1;

        cell.layer.transform = CATransform3DIdentity;

        [UIView commitAnimations];

    }

    

}




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

    if ([[NSUserDefaults standardUserDefaults]boolForKey:kCouponCacheFlag] ) {

        if (indexPath.row == 1 && indexPath.section <2) {

//            cell.layer.shadowColor = [[UIColor blackColor] CGColor];

//            cell.layer.shadowOffset = CGSizeMake(10, 10);

//            cell.alpha = 0;

//            cell.layer.transform = CATransform3DMakeScale(1, -1, 1);

//            cell.layer.anchorPoint = CGPointMake(0.5, -0.5);

            cell.height = 64 ;

            cell.alpha = 0;

            cell.top = cell.top-96;

            [UIView animateWithDuration:.8 delay:indexPath.section*.5 options:UIViewAnimationOptionCurveEaseInOut animations:^{

                cell.layer.shadowOffset = CGSizeMake(0, 0);

                cell.alpha = 1;

//                cell.layer.transform = CATransform3DIdentity;

                cell.height = 96;

                cell.top = 0;


            } completion:^(BOOL finished) {

                

            }];


        }

  

    }

    

}



//This function is where all the magic happens

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

//    if (indexPath.row ==1) {

//        if(kAnimationFlag==2)

//            return;

//        CGFloat originHeight = cell.height;

//        cell.top = -originHeight;

//        cell.height = 0;

//      [UIView animateWithDuration:.2*(indexPath.section+2)

//                       delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{

//                           cell.top = 0;

//                           cell.height = originHeight;

//                           kAnimationFlag ++;

//                       } completion:^(BOOL finished){

//                           kAnimationFlag--;

//                       }];

//    }


////    //1. Setup the CATransform3D structure

////    CATransform3D rotation;

////    rotation = CATransform3DMakeRotation( (90.0*M_PI)/180, 0.0, 0.7, 0.4);

////    rotation.m34 = 1.0/ -600;

////

////    //2. Define the initial state (Before the animation)

////  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. Define the final state (After the animation) and commit the animation

//[UIView beginAnimations:@"postio" context:NULL];

//[UIView setAnimationDuration:0.8];

//cell.layer.transform = CATransform3DIdentity;

//cell.alpha = 1;

//cell.layer.shadowOffset = CGSizeMake(0, 0);

//[UIView commitAnimations];

//    }

//}

你可能感兴趣的:(动画,object-c)