//
//  TTTableViewController.swift
//  tableVIewAnimation
//
//  Created by su on 15/12/11.
//  Copyright © 2015年 tian. All rights reserved.
//

import UIKit

class TTTableViewController: UITableViewController {

override func viewDidLoad() {
        super.viewDidLoad()
        //重载一下数据
        tableView.reloadData()
        //动画延时
        let diff = 0.05
        //获取tableview的高
        let tableHeight = self.tableView.bounds.size.height
        //获取所有的单元格
        let cells:[UITableViewCell] = self.tableView.visibleCells as [UITableViewCell]
        //遍历单元格
        for cell in cells {
            cell.transform = CGAffineTransformMakeTranslation(0, tableHeight)
        }
        //遍历cell顺序执行上移的动画
        for i in 0..<cells.count {
            let cell:UITableViewCell = cells[i] as UITableViewCell
            //根据序列号决定延时时间
            let delay = diff * Double(i)
            //执行动画
            UIView.animateWithDuration(1, delay: delay, options: UIViewAnimationOptions.CurveEaseInOut, animations: { () -> Void in
                //重新回到原始位置
                cell.transform = CGAffineTransformMakeTranslation(0, 0)
                }, completion: nil)
        }
    }

override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
      
        return 20
    }

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
       
        cell.textLabel?.text = "数据:\(indexPath.row)"
        cell.detailTextLabel?.text = "数据\(indexPath.row)"
        return cell
    }
  

}

最新文章

  1. Retrofit2.0起步篇
  2. hibernate-取消关联外键引用数据丢失抛异常的设置@NotFound
  3. [Codeforces] 347B - Fixed Points
  4. Git commit template 模板设定
  5. SQL Server 中同时操作的例子:
  6. 【转】android创建Popwindow弹出菜单的两种方式
  7. vuethink 配置
  8. MTK 软件设置路径
  9. 后端开发者的Vue学习之路(五)
  10. html5 渐变按钮练习
  11. ContOS7编译安装python3,配置虚拟环境
  12. EBS测试环境DataGuard配置
  13. Java 发送SOAP请求调用WebService,解析SOAP报文
  14. php学习笔记1——使用phpStudy进行php运行环境搭建与测试。
  15. IOS tableView的一些问题总结
  16. SignalR2简易数据看板演示
  17. iOS-消除CocoaPods内容警告
  18. POJ 1221
  19. Struts 2 Tutorial Basic MVC Architecture
  20. Android SharedPreferences保存和读取对象

热门文章

  1. shell编写redis启动脚本
  2. [Spring] Resource 资源
  3. 蓝桥杯历届试题-垒色子(DP+矩阵快速幂)
  4. 5月31日上课笔记-Mysql简介
  5. modelsim 的高效使用
  6. Oracle 11g 新特性 -- Oracle Restart 说明(转载)
  7. Oracle中 HWM与数据库性能的探讨
  8. pm无力的话
  9. HyberLedger Fabric学习(4)-chaincode学习(操作人员)
  10. javascript的中的new