设为首页 加入收藏

TOP

iOS开发UI篇-实现tableView的层级显示(二)
2017-10-13 10:33:03 】 浏览:3516
Tags:iOS 开发 UI篇 实现 tableView 层级 显示
onary setValue:@(1) forKey:clickTag];
}else{ //状态为1 代表展开 [self.boolDcitionary setValue:@(0) forKey:clickTag]; }


//    //第二个cell展开时自动关闭之前展开的cell
//    //状态为0 代表关闭
//    if ([self.boolDcitionary[clickTag] integerValue] == 0) {
//        
//        for (int i = 1000; i < (1000 + 20); i++) {
//            NSString *clickStr = [NSString stringWithFormat:@"%d",i];
//            if ([clickStr isEqualToString:clickTag]) {
//                
//                [self.boolDcitionary setValue:@(1) forKey:clickStr];
//                
//            }else{
//                
//                [self.boolDcitionary setValue:@(0) forKey:clickStr];
//            }
//            
//        }
//    }else{
//        //状态为1 代表展开
//        [self.boolDcitionary setValue:@(0) forKey:clickTag];
//    }



//刷新tableView(不可少) [_MyTableView reloadData]; } #pragma mark - 懒加载 -(NSMutableDictionary *)boolDcitionary{ if (!_boolDcitionary) { _boolDcitionary = [NSMutableDictionary dictionary]; } return _boolDcitionary; } - (NSMutableArray *)dataArray{ if (!_dataArray) { _dataArray = [NSMutableArray array]; } return _dataArray; }

 

 那么又有人问了,我的cell虽然展开了,但是都是直上直下得展开,还没有一点动画效果.下面给大家介绍一下cell展开的动画效果实现.

  实现下面UITableViewDelegate的方法

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

写一个UITableViewCell的简单动画效果.

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    
    CATransform3D rotation;
    rotation = CATransform3DMakeRotation( (90.0*M_PI)/180, 0.0, 0.7, 0.4);
    rotation.m34 = 1.0/ -600;
    
    cell.layer.shadowColor = [[UIColor blackColor]CGColor];
    cell.layer.shadowOffset = CGSizeMake(10, 10);
    cell.alpha = 0;
    cell.layer.transform = rotation;
    
    [UIView beginAnimations:@"rotation" context:NULL];
    [UIView setAnimationDuration:0.8];
    cell.layer.transform = CATransform3DIdentity;
    cell.alpha = 1;
    cell.layer.shadowOffset = CGSizeMake(0, 0);
    [UIView commitAnimations];
}

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇iOS开发篇-申请开发者账号流程 下一篇关于UIView布局的总结

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目