Commit 196f85097f930d47f248307185df28681c15d24a

Authored by “zhangxu@cnlive.com”
1 parent 605a2a3b

首页加下拉刷新

metaCode/Classes/Main/HomePages/Controller/AuthController/CNLiveAuthViewController.swift
... ... @@ -6,7 +6,7 @@
6 6 //
7 7  
8 8 import Foundation
9   -
  9 +import MJRefresh
10 10 class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{
11 11  
12 12 //下滑tableview背景颜色
... ... @@ -62,9 +62,9 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
62 62 override func viewDidLoad() {
63 63 super.viewDidLoad()
64 64 self.view.backgroundColor = .white
65   -// self.view.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
66 65 view.addSubview(tableView)
67 66 tableView.frame = CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth, height: KSreenHeight-DownSlideBottomViewHeight-KStatusBarHeight)
  67 + self.addRefreshView()
68 68 self.getHomePageConfigListApi()
69 69 }
70 70  
... ... @@ -282,6 +282,11 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
282 282 return 0
283 283 }
284 284  
  285 + func addRefreshView() {
  286 + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in
  287 + self!.getHomePageConfigListApi()
  288 + })
  289 + }
285 290 //MARK: - 获取首页配置
286 291 func getHomePageConfigListApi(){
287 292 CNLiveHomePageViewModel.requestGetHomePageConfigList{ result, status in
... ... @@ -317,6 +322,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
317 322 //隐藏在追短剧cell
318 323 self.isHaveDuanJU = false
319 324 }
  325 + self.tableView.mj_header?.endRefreshing()
320 326 self.tableView.reloadData()
321 327  
322 328 }else{
... ... @@ -343,7 +349,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
343 349 }
344 350 }
345 351 self.dataArray.addObjects(from: newDataArray as! [Any])
346   -
  352 + self.tableView.mj_header?.endRefreshing()
347 353 self.tableView.reloadData()
348 354 }else if (status == .failed){
349 355 // self.NetApiStatus = .apiError
... ...