zoukankan      html  css  js  c++  java
  • swift

    //
    //  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
        }
      
    }
  • 相关阅读:
    程序员找工作必备 PHP 基础面试题 (四)
    Laravel 教程:使用Fast Excel解决导出超大 XLSX 文件(千万级)带来的内存问题
    ThinkPHP无限分类的使用
    PHP 的 interface 有什么用处?
    编写可读代码:通过提前返回来减少缩进
    调试事件的派发
    调试对象的构建
    [反汇编分析] 局部变量复用
    [IDA]批量载入结构体
    [反汇编分析]调用函数传入参数不一致时可能寄存器传入参数
  • 原文地址:https://www.cnblogs.com/tian-sun/p/5038647.html
Copyright © 2011-2022 走看看