Commit 0c4d06f7 authored by lujunye's avatar lujunye

地址管理列表更改下拉刷新模式

parent 14f598fa
...@@ -16,11 +16,11 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData ...@@ -16,11 +16,11 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
func sureGeliAlertViewAction(sender: UIButton) { func sureGeliAlertViewAction(sender: UIButton) {
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
let model = adrArrs[sender.tag] let model = adrArrs[sender.tag]
AddressDel(["user_token":UserToken as Any,"address_id":model.address_id as Any], success: { (data) in AddressDel(["user_token":UserToken as Any,"address_id":model.address_id as Any], success: { (data) in
self.loadData() self.loadData()
}) { (error) in }) { (error) in
} }
} }
...@@ -64,7 +64,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData ...@@ -64,7 +64,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
//MARK:--清空搜索代理 //MARK:--清空搜索代理
func clearSearchAction() { func clearSearchAction() {
} }
//MARK:--编辑即将结束 //MARK:--编辑即将结束
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
...@@ -133,7 +133,11 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData ...@@ -133,7 +133,11 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
navbar.rightTitle = "新增" navbar.rightTitle = "新增"
searchBgH.constant = 45 searchBgH.constant = 45
loadData()
//下拉刷新相关设置
headerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadData))
self.listView!.mj_header = headerMJ
self.listView.mj_header?.beginRefreshing()
} }
listView.separatorStyle = .none listView.separatorStyle = .none
// SetTopFrameView(view: listView, btmView: btmLbl) // SetTopFrameView(view: listView, btmView: btmLbl)
...@@ -148,7 +152,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData ...@@ -148,7 +152,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
btmLblHeight.constant = 0 btmLblHeight.constant = 0
} }
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
...@@ -162,8 +166,10 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData ...@@ -162,8 +166,10 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}) })
self.listView.reloadData() self.listView.reloadData()
HUD.hide() HUD.hide()
}) { (error) in self.listView.mj_header?.endRefreshing()
}) { (data) in
self.listView.mj_header?.endRefreshing()
} }
} }
...@@ -290,20 +296,20 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData ...@@ -290,20 +296,20 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
return options return options
} }
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? { func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
let tag = indexPath.row let tag = indexPath.row
//创建“删除”事件按钮 //创建“删除”事件按钮
let deleteAction = SwipeAction(style: .destructive, title: nil) { let deleteAction = SwipeAction(style: .destructive, title: nil) {
action, indexPath in action, indexPath in
//将对应条目的数据删除 //将对应条目的数据删除
let alertView = GeliAlertView(frame: self.view.window!.bounds) let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self alertView.delegate = self
alertView.tishiLbl.text = "" alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否删除地址?" alertView.titileLbl.text = "是否删除地址?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal) alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal)
alertView.rightBtn.tag = tag alertView.rightBtn.tag = tag
self.view.window?.addSubview(alertView) self.view.window?.addSubview(alertView)
} }
deleteAction.image = UIImage(named: "shanchuWhite") deleteAction.image = UIImage(named: "shanchuWhite")
deleteAction.backgroundColor = UIColor(named: "#F57575") deleteAction.backgroundColor = UIColor(named: "#F57575")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment