Swift - UITableView展开缩放动画

效果

源码

https://github.com/YouXianMing/Swift-Animations

//
// HeaderViewTapAnimationController.swift
// Swift-Animations
//
// Created by YouXianMing on 16/8/9.
// Copyright © 2016年 YouXianMing. All rights reserved.
// import UIKit class HeaderViewTapAnimationController: NormalTitleViewController, UITableViewDelegate, UITableViewDataSource { private var classes : [ClassModel]!
private var tableView : UITableView!
private var sectionFirstLoad : Bool!
private weak var tmpHeadView : ClassHeaderView! override func setup() { super.setup() sectionFirstLoad = false // TableView.
tableView = UITableView(frame: (contentView?.bounds)!)
tableView.dataSource = self
tableView.delegate = self
tableView.rowHeight =
tableView.sectionHeaderHeight =
tableView.separatorStyle = .None
contentView?.addSubview(tableView!) // Register.
ClassHeaderView.registerToTableView(tableView)
StudentInfoCell.registerToTableView(tableView) // Data source.
let Aitna = ClassModel(className: "Aitna")
Aitna.expend = false
Aitna.students?.append(StudentModel(name: "Y.X.M.", age: ))
Aitna.students?.append(StudentModel(name: "Leif", age: ))
Aitna.students?.append(StudentModel(name: "Lennon", age: ))
Aitna.students?.append(StudentModel(name: "Jerome", age: ))
Aitna.students?.append(StudentModel(name: "Isidore", age: )) let Melete = ClassModel(className: "Melete")
Melete.expend = false
Melete.students?.append(StudentModel(name: "Merle", age: ))
Melete.students?.append(StudentModel(name: "Paddy", age: ))
Melete.students?.append(StudentModel(name: "Perry", age: ))
Melete.students?.append(StudentModel(name: "Philip", age: )) let Aoede = ClassModel(className: "Aoede")
Aoede.expend = false
Aoede.students?.append(StudentModel(name: "Verne", age: ))
Aoede.students?.append(StudentModel(name: "Vincent", age: ))
Aoede.students?.append(StudentModel(name: "Walter", age: ))
Aoede.students?.append(StudentModel(name: "Zachary", age: )) let Dione = ClassModel(className: "Dione")
Dione.expend = false
Dione.students?.append(StudentModel(name: "Timothy", age: ))
Dione.students?.append(StudentModel(name: "Roderick", age: ))
Dione.students?.append(StudentModel(name: "Quentin", age: ))
Dione.students?.append(StudentModel(name: "Paddy", age: )) let Adanos = ClassModel(className: "Adanos")
Adanos.expend = false
Adanos.students?.append(StudentModel(name: "Mortimer", age: ))
Adanos.students?.append(StudentModel(name: "Michael", age: ))
Adanos.students?.append(StudentModel(name: "Kevin", age: ))
Adanos.students?.append(StudentModel(name: "Jeremy", age: )) classes = [ClassModel]()
classes.append(Aitna)
classes.append(Melete)
classes.append(Aoede)
classes.append(Dione)
classes.append(Adanos) // Expend animations.
GCDQueue.executeInMainQueue({ self.sectionFirstLoad = true
self.tableView.insertSections(NSIndexSet(indexesInRange: NSMakeRange(, self.classes.count)), withRowAnimation: .Fade) GCDQueue.executeInMainQueue({ self.tmpHeadView.buttonEvent() }, afterDelaySeconds: 0.4)
}, afterDelaySeconds: 0.3)
} // MARK: UITableView's delegate & dataSource. func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { let classModel = classes[section]
if classModel.expend == true { return (classModel.students?.count)! } else { return
}
} func numberOfSectionsInTableView(tableView: UITableView) -> Int { if sectionFirstLoad == false { return } else { return classes.count
}
} func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let classModel = classes[indexPath.section]
let customCell = tableView.dequeueReusableCellWithIdentifier("StudentInfoCell") as! CustomCell
customCell.data = classModel.students![indexPath.row]
customCell.indexPath = indexPath
customCell.loadContent() return customCell
} func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { tableView.selectedEventWithIndexPath(indexPath)
} func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = tableView.dequeueReusableHeaderFooterViewWithIdentifier("ClassHeaderView") as! ClassHeaderView
headerView.section = section
headerView.data = classes[section]
headerView.tableView = tableView
headerView.loadContent() if tmpHeadView == nil && section == { tmpHeadView = headerView
} return headerView
}
}

Swift - UITableView展开缩放动画的更多相关文章

  1. UITableView的headerView展开缩放动画

    UITableView的headerView展开缩放动画 效果 源码 https://github.com/YouXianMing/Animations // // HeaderViewTapAnim ...

  2. 仿Inshot分享页图片圆形展开缩放动画

    版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/221 圆形展开缩放动画 关键代码: final Anima ...

  3. Android实现Layout缩放动画

    最近看到Any.do的缩放效果很酷,看到一篇讲Layout缩放动画实现的文章,记录一下: http://edison-cool911.iteye.com/blog/704812

  4. 动画--问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题。

    http://www.bkjia.com/Androidjc/929473.html: 问题追踪:ImageView执行缩放动画ScaleAnimation之后,图像显示不全的问题., 问题:我有一个 ...

  5. iOS开发笔记10:圆点缩放动画、强制更新、远程推送加语音提醒及UIView截屏

    1.使用CAReplicatorLayer制作等待动画 CALayer+CABasicAnimation可以制作很多简单的动画效果,之前的博客中介绍的“两个动画”,一个是利用一张渐变色图片+CABas ...

  6. AndroidUI 视图动画-缩放动画效果 (ScaleAnimation)

    放动画效果,可以使用ScaleAnimation: <Button android:id="@+id/btnScale2" android:layout_width=&quo ...

  7. AndroidTv Home界面实现原理(二)——Leanback 库的主页卡位缩放动画源码解析

    先看个效果图: 上一篇中,我们留了问题,在 Tv Home 界面这种很常见聚焦卡位放大动画效果,我们这一篇就来看看 Leanback 库是怎么实现的. 如果要我们自己实现的话,思路应该不难,就是写个放 ...

  8. Android缩放动画

    Android缩放动画 核心方法 public void startAnimation(Animation animation) 执行动画,参数可以是各种动画的对象,Animation的多态,也可以是 ...

  9. UI设计篇·入门篇·简单动画的实现,透明动画/旋转动画/移动动画/缩放动画,混合动画效果的实现,为动画设置监听事件,自定义动画的方法

    基本的动画构成共有四种:透明动画/旋转动画/移动动画/缩放动画. 配置动画的方式有两种,一种是直接使用代码来配置动画效果,另一种是使用xml文档配置动画效果 相比而言,用xml文档写出来的动画效果,写 ...

随机推荐

  1. LeetCode(15):三数之和

    Medium! 题目描述: 给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组. 注意:答 ...

  2. PHP 字符串截取()[]{} 中内容

    $str="你好<我>(爱)[北京]{天安门}"; echo f1($str); //返回你好 echo f2($str); //返回我 echo f3($str); ...

  3. VC++一些开发心得与调试技巧

         1.如何在Release状态下进行调试 Project->Setting=>ProjectSetting对话框,选择Release状态.C/C++标签中的Category选Gen ...

  4. Excel学习笔记:sumif、sumifs、countifs函数使用方法

    本篇纯粹记录一下sumif.sumifs.countifs函数的使用方法. 一.sumif函数 按条件求和 使用格式:=sumif(条件区域,求和条件,实际求和区域) =SUMIF($B$7:$B$1 ...

  5. Asp.Net Mvc5 结合 SignalR2.0+ 实现消息交互简单例子

    Nuget添加 SignalR包 1.构建一个MyHubServer服务端类 定义类的特性标签为 [HubName("chatHub")] public class MyHubSe ...

  6. mysql 事务隔离级别 详解

    问题 在工作中真实遇到的问题:用python连接mysql,查询数据,同时有别的代码在更新mysql中的数据,前者是一直是保持连接的数据库,每一分钟select一次,但第二次却查不到更新后的数据?wh ...

  7. 016.Zabbix聚合监控

    一 Zabbix监控机汇总计算 用Calcuated Items可以对Items进行汇总计算,如求磁盘总容量.网络流量,只依赖于Zabbix-Server,与Zabbix-Agent和proxy无关. ...

  8. InnoDB的锁机制浅析(一)—基本概念/兼容矩阵

    InnoDB锁的基本概念 文章总共分为五个部分: InnoDB的锁机制浅析(一)-基本概念/兼容矩阵 InnoDB的锁机制浅析(二)-探索InnoDB中的锁(Record锁/Gap锁/Next-key ...

  9. NOIp模拟赛 巨神兵(状压DP 容斥)

    \(Description\) 给定\(n\)个点\(m\)条边的有向图,求有多少个边集的子集,构成的图没有环. \(n\leq17\). \(Solution\) 问题也等价于,用不同的边集构造DA ...

  10. Codeforces Round #369 (Div. 2) A. Bus to Udayland 水题

    A. Bus to Udayland 题目连接: http://www.codeforces.com/contest/711/problem/A Description ZS the Coder an ...