Swift-uitableview Status Switch effect
Effect
Source
Https://github.com/YouXianMing/Swift-Animations
////Tableviewtapanimationcontroller.swift//swift-animations////Created by youxianming on 16/8/7.//copyright©2016 year youxianming. All rights reserved.//Import UIKitclassTableviewtapanimationcontroller:normaltitleviewcontroller, Uitableviewdelegate, UITableViewDataSource {var Adapters:nsmutablearray!var tableview:uitableview!Overridefunc Setup () {Super.setup ()//TableView.TableView = UITableView (frame: (Contentview?. Bounds)!) Tableview.datasource=Self tableView.Delegate=Self tableview.separatorstyle= . None Contentview?. Addsubview (tableview!) //Register cell.Tableviewtapanimationcell.registertotableview (TableView, Cellreuseidentifier:nil)//Data source.adapters =Nsmutablearray () adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (TapAnimationModel (name:
"youxianming", Selected:false), Cellheight: the)) Adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (Tapanimationmodel (name:"Animations", Selected:false), Cellheight: the)) Adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (Tapanimationmodel (name:"Yocelsius", Selected:false), Cellheight: the)) Adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (Tapanimationmodel (name:"Ios-progrommer", Selected:false), Cellheight: the)) Adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (Tapanimationmodel (name:"Design-patterns", Selected:false), Cellheight: the)) Adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (Tapanimationmodel (name:"Arabia-terra", Selected:false), Cellheight: the)) Adapters.addobject (Tableviewtapanimationcell.dataadapterwithdata (Tapanimationmodel (name:"Swift", Selected:false), Cellheight: the)) } //Mark:uitableview ' s delegate & DataSource.func TableView (Tableview:uitableview, numberofrowsinsection section:int)-Int {returnAdapters.count} func TableView (Tableview:uitableview, Cellforrowatindexpath Indexpath:nsindexpath)-UITableViewCell {returnTableview.dequeueandloadcontentreusablecellfromadapter (Adapters[indexpath.row] as!celldataadapter, Indexpath:indexpath)} Func TableView (Tableview:uitableview, Didselectrowatindexpath indexpath:nsindexpath) {tableview.selected Eventwithindexpath (Indexpath)} func TableView (Tableview:uitableview, Heightforrowatindexpath Indexpath:nsinde XPath)-CGFloat {return(Adapters[indexpath.row] as! Celldataadapter). cellheight! }}
Swift-uitableview Status Switch effect