override func viewDidLoad() {
super.viewDidLoad()
self.tableView.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: "tableViewCell")
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 44
self.tableView.tableFooterView = UIView()
// self.tableView.addHeadRefresh(self) { () -> () in
// self.loadNewData()
// }
self.tableView.addHeadRefresh(self, action: "loadNewData")
self.tableView.head?.hideTimeLabel=true
self.tableView.addFootRefresh(self, action: "loadMoreData")
}
func loadNewData(){
//延时模拟刷新
self.index = 0
DeLayTime(2.0, closure: { () -> () in
self.dataArr.removeAllObjects()
for (var i = 0 ;i<5;i++){
let str = "最新5个cell,第\(self.index++)个"
self.dataArr.addObject(str)
}
self.tableView.reloadData()
self.tableView .tableHeadStopRefreshing()
})
}
func DeLayTime(x:Double,closure:()->()){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(x * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), closure)
}
/* *bgColor 背景颜色 *loadingColor 加载的颜色 */ public func addBounceHeadRefresh(target:AnyObject?,bgColor:UIColor,loadingColor:UIColor,action : Selector); //实现如下 self.tableView.addBounceHeadRefresh(self,bgColor:UIColor.orangeColor(),loadingColor:UIColor.blueColor(), action: "loadNewData")
self.tableView.tableHeadStopRefreshing() self.tableView.tableFootStopRefreshing
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有