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