效果
源码
https://github.com/youxianming/swift-animations
// // tableviewtapanimationcontroller.swift // swift-animations // // created by youxianming on 16/8/7. // 凯发网娱乐官网下载 copyright © 2016年 youxianming. all rights reserved. // import uikit class tableviewtapanimationcontroller: normaltitleviewcontroller, uitableviewdelegate, uitableviewdatasource { var adapters : nsmutablearray! var tableview : uitableview! override func 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: 80)) adapters.addobject(tableviewtapanimationcell.dataadapterwithdata(tapanimationmodel(name: "animations", selected: false), cellheight: 80)) adapters.addobject(tableviewtapanimationcell.dataadapterwithdata(tapanimationmodel(name: "yocelsius", selected: false), cellheight: 80)) adapters.addobject(tableviewtapanimationcell.dataadapterwithdata(tapanimationmodel(name: "ios-progrommer", selected: false), cellheight: 80)) adapters.addobject(tableviewtapanimationcell.dataadapterwithdata(tapanimationmodel(name: "design-patterns", selected: false), cellheight: 80)) adapters.addobject(tableviewtapanimationcell.dataadapterwithdata(tapanimationmodel(name: "arabia-terra", selected: false), cellheight: 80)) adapters.addobject(tableviewtapanimationcell.dataadapterwithdata(tapanimationmodel(name: "swift", selected: false), cellheight: 80)) } // mark: uitableview's delegate & datasource. func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return adapters.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { return tableview.dequeueandloadcontentreusablecellfromadapter(adapters[indexpath.row] as! celldataadapter, indexpath: indexpath) } func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.selectedeventwithindexpath(indexpath) } func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { return (adapters[indexpath.row] as! celldataadapter).cellheight! } }
以上所述是小编给大家介绍的swift开发之uitableview状态切换效果,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的,