csdn博客登录

cell的动态变化效果 




#import "RootViewController.h"


@interface RootViewController ()


///数据源

@property (nonatomic, strong) NSMutableArray *dataArray ;


@end


@implementation RootViewController


- (void)viewDidLoad {

    [super viewDidLoad];

    //初始化数据源

    self.dataArray = [NSMutableArray arrayWithCapacity:1];

    //for循环

    for (int i = 0 ; i< 100; i++) {

        NSString * str = @"  ***************坤灵宜家****************  ";

        [_dataArray addObject:str];

    }

    

    

    

    

    }


- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}


#pragma mark - Table view data source


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;

}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return _dataArray.count;

}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];

    cell.textLabel.text = self.dataArray[indexPath.row];

    cell.backgroundColor = [UIColor yellowColor];

    return cell;

}


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

    ///配置 CATransform3D 动画内容

    CATransform3D  transform ;

    transform.m34 = 1.0/-800;

    //定义 Cell的初始化状态

    cell.layer.transform = transform;

    //定义Cell 最终状态 并且提交动画

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

    [UIView setAnimationDuration:1];

    cell.layer.transform = CATransform3DIdentity;

    cell.frame = CGRectMake(0, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height);

    [UIView commitAnimations];

    

    

}

@end




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值