Commit 67b30ebf authored by lujunye's avatar lujunye

添加更改地址顺序

parent 4a0f8916
...@@ -258,6 +258,8 @@ ...@@ -258,6 +258,8 @@
E0AA3A89248F3E1400CBFC27 /* StatisticsInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AA3A88248F3E1400CBFC27 /* StatisticsInterface.swift */; }; E0AA3A89248F3E1400CBFC27 /* StatisticsInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AA3A88248F3E1400CBFC27 /* StatisticsInterface.swift */; };
E0AA3A91248F626400CBFC27 /* XinCaiGouViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AA3A8F248F626400CBFC27 /* XinCaiGouViewController.swift */; }; E0AA3A91248F626400CBFC27 /* XinCaiGouViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0AA3A8F248F626400CBFC27 /* XinCaiGouViewController.swift */; };
E0AA3A92248F626400CBFC27 /* XinCaiGouViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0AA3A90248F626400CBFC27 /* XinCaiGouViewController.xib */; }; E0AA3A92248F626400CBFC27 /* XinCaiGouViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0AA3A90248F626400CBFC27 /* XinCaiGouViewController.xib */; };
E0B28DAC24D3B15E00997C69 /* HuoLaLaDiZhiCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B28DAA24D3B15E00997C69 /* HuoLaLaDiZhiCell.swift */; };
E0B28DAD24D3B15E00997C69 /* HuoLaLaDiZhiCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0B28DAB24D3B15E00997C69 /* HuoLaLaDiZhiCell.xib */; };
E0B5307E247266F400FFCC15 /* DKXDAdrCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B5307C247266F400FFCC15 /* DKXDAdrCell.swift */; }; E0B5307E247266F400FFCC15 /* DKXDAdrCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B5307C247266F400FFCC15 /* DKXDAdrCell.swift */; };
E0B5307F247266F400FFCC15 /* DKXDAdrCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0B5307D247266F400FFCC15 /* DKXDAdrCell.xib */; }; E0B5307F247266F400FFCC15 /* DKXDAdrCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0B5307D247266F400FFCC15 /* DKXDAdrCell.xib */; };
E0B5308424728D7E00FFCC15 /* ShopWarehouseListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B5308324728D7E00FFCC15 /* ShopWarehouseListModel.swift */; }; E0B5308424728D7E00FFCC15 /* ShopWarehouseListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B5308324728D7E00FFCC15 /* ShopWarehouseListModel.swift */; };
...@@ -871,6 +873,8 @@ ...@@ -871,6 +873,8 @@
E0AA3A88248F3E1400CBFC27 /* StatisticsInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsInterface.swift; sourceTree = "<group>"; }; E0AA3A88248F3E1400CBFC27 /* StatisticsInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsInterface.swift; sourceTree = "<group>"; };
E0AA3A8F248F626400CBFC27 /* XinCaiGouViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinCaiGouViewController.swift; sourceTree = "<group>"; }; E0AA3A8F248F626400CBFC27 /* XinCaiGouViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinCaiGouViewController.swift; sourceTree = "<group>"; };
E0AA3A90248F626400CBFC27 /* XinCaiGouViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinCaiGouViewController.xib; sourceTree = "<group>"; }; E0AA3A90248F626400CBFC27 /* XinCaiGouViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinCaiGouViewController.xib; sourceTree = "<group>"; };
E0B28DAA24D3B15E00997C69 /* HuoLaLaDiZhiCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HuoLaLaDiZhiCell.swift; sourceTree = "<group>"; };
E0B28DAB24D3B15E00997C69 /* HuoLaLaDiZhiCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HuoLaLaDiZhiCell.xib; sourceTree = "<group>"; };
E0B5307C247266F400FFCC15 /* DKXDAdrCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DKXDAdrCell.swift; sourceTree = "<group>"; }; E0B5307C247266F400FFCC15 /* DKXDAdrCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DKXDAdrCell.swift; sourceTree = "<group>"; };
E0B5307D247266F400FFCC15 /* DKXDAdrCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DKXDAdrCell.xib; sourceTree = "<group>"; }; E0B5307D247266F400FFCC15 /* DKXDAdrCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DKXDAdrCell.xib; sourceTree = "<group>"; };
E0B5308324728D7E00FFCC15 /* ShopWarehouseListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopWarehouseListModel.swift; sourceTree = "<group>"; }; E0B5308324728D7E00FFCC15 /* ShopWarehouseListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopWarehouseListModel.swift; sourceTree = "<group>"; };
...@@ -3006,6 +3010,8 @@ ...@@ -3006,6 +3010,8 @@
children = ( children = (
F9D44E8624CBC6A400FBD8DB /* ToAndFormSelectViewController.swift */, F9D44E8624CBC6A400FBD8DB /* ToAndFormSelectViewController.swift */,
F9D44E8724CBC6A400FBD8DB /* ToAndFormSelectViewController.xib */, F9D44E8724CBC6A400FBD8DB /* ToAndFormSelectViewController.xib */,
E0B28DAA24D3B15E00997C69 /* HuoLaLaDiZhiCell.swift */,
E0B28DAB24D3B15E00997C69 /* HuoLaLaDiZhiCell.xib */,
); );
path = "收发货地址"; path = "收发货地址";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3159,6 +3165,7 @@ ...@@ -3159,6 +3165,7 @@
E0B9461F24566B3100FBEC9A /* TitleAndTFAndBtnCell.xib in Resources */, E0B9461F24566B3100FBEC9A /* TitleAndTFAndBtnCell.xib in Resources */,
E08A7ADD246505F000F934F2 /* KeHuListViewController.xib in Resources */, E08A7ADD246505F000F934F2 /* KeHuListViewController.xib in Resources */,
E0DDCB10244AD8C500DF54C7 /* DaiQueRenCell.xib in Resources */, E0DDCB10244AD8C500DF54C7 /* DaiQueRenCell.xib in Resources */,
E0B28DAD24D3B15E00997C69 /* HuoLaLaDiZhiCell.xib in Resources */,
F94A31652462B21700FEC38E /* EditWorkCViewController.xib in Resources */, F94A31652462B21700FEC38E /* EditWorkCViewController.xib in Resources */,
E0BE8A9D245A9E5900E80134 /* YingFuZhangKuanXQCell.xib in Resources */, E0BE8A9D245A9E5900E80134 /* YingFuZhangKuanXQCell.xib in Resources */,
F96A5856247BBFFF0070A057 /* AddGuiGeCell.xib in Resources */, F96A5856247BBFFF0070A057 /* AddGuiGeCell.xib in Resources */,
...@@ -3696,6 +3703,7 @@ ...@@ -3696,6 +3703,7 @@
E02DDD952450106C00ABB707 /* PuTongJieTiCell.swift in Sources */, E02DDD952450106C00ABB707 /* PuTongJieTiCell.swift in Sources */,
E0BE8A8B245A7D3300E80134 /* BtmBtnCell.swift in Sources */, E0BE8A8B245A7D3300E80134 /* BtmBtnCell.swift in Sources */,
E0CC848424823B72009B1FE9 /* InGoodsDetailModel.swift in Sources */, E0CC848424823B72009B1FE9 /* InGoodsDetailModel.swift in Sources */,
E0B28DAC24D3B15E00997C69 /* HuoLaLaDiZhiCell.swift in Sources */,
F9531F452465108800724BEE /* JXPhotoBrowserLog.swift in Sources */, F9531F452465108800724BEE /* JXPhotoBrowserLog.swift in Sources */,
F956D5A3246A2D9C003FF510 /* LMNImageInputViewController.m in Sources */, F956D5A3246A2D9C003FF510 /* LMNImageInputViewController.m in Sources */,
F9956B1E2463D94E001A617D /* WorkSelectTimeView.swift in Sources */, F9956B1E2463D94E001A617D /* WorkSelectTimeView.swift in Sources */,
......
...@@ -485,11 +485,15 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -485,11 +485,15 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
let leftBtn = UIButton(frame: CGRect(x: 0, y: 0, width: fullScreenWidth*0.5, height: 44)) let leftBtn = UIButton(frame: CGRect(x: 0, y: 0, width: fullScreenWidth*0.5, height: 44))
leftBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13) leftBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
leftBtn.setTitle("调整收货地顺序", for: .normal) leftBtn.setTitle("调整收货地顺序", for: .normal)
leftBtn.addTarget(self, action: #selector(huoLLAdrAction(sender:)), for: .touchUpInside)
leftBtn.tag = 0
leftBtn.setTitleColor(UIColor(named: "灰色字体颜色"), for: .normal) leftBtn.setTitleColor(UIColor(named: "灰色字体颜色"), for: .normal)
view.addSubview(leftBtn) view.addSubview(leftBtn)
let rightBtn = UIButton(frame: CGRect(x: fullScreenWidth*0.5, y: 0, width: fullScreenWidth*0.5, height: 44)) let rightBtn = UIButton(frame: CGRect(x: fullScreenWidth*0.5, y: 0, width: fullScreenWidth*0.5, height: 44))
rightBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13) rightBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
rightBtn.setTitle("添加收货地址", for: .normal) rightBtn.setTitle("添加收货地址", for: .normal)
rightBtn.tag = 1
rightBtn.addTarget(self, action: #selector(huoLLAdrAction(sender:)), for: .touchUpInside)
rightBtn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal) rightBtn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
view.addSubview(rightBtn) view.addSubview(rightBtn)
return view return view
...@@ -498,6 +502,144 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -498,6 +502,144 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
return view return view
} }
} }
var closeBtn:UIButton?
var changeCellSortView:UIView?
//MARK: - 改变地址顺序
@objc func huoLLAdrAction(sender:UIButton){
if sender.tag == 0 {
print("调位置")
var h = CGFloat(adrArr.count + 2)*49
if h > CGFloat(fullScreenHeight) * 0.65 {
h = CGFloat(fullScreenHeight) * 0.65
}
changeCellSortView?.isHidden = false
closeBtn?.isHidden = false
if closeBtn == nil {
closeBtn = UIButton(frame: self.view.bounds)
closeBtn?.backgroundColor = UIColor(named: "标题字颜色")
closeBtn?.alpha = 0.4
closeBtn?.addTarget(self, action: #selector(closeCarList), for: .touchUpInside)
self.view.addSubview(closeBtn!)
changeCellSortView = UIView(frame: CGRect(x: 0, y: fullScreenHeight - CGFloat(h), width: fullScreenWidth, height: CGFloat(h)))
changeCellSortView?.backgroundColor = UIColor.white
changeCellSortView?.layer.cornerRadius = 5
changeCellSortView?.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner,CACornerMask.layerMaxXMinYCorner]
self.view.addSubview(changeCellSortView!)
let leftBtn = UIButton()
leftBtn.addTarget(self, action: #selector(changeCellSortAc(sender:)), for: .touchUpInside)
leftBtn.backgroundColor = RGB(r: 170, g: 205, b: 240)
leftBtn.setTitle("取消", for: .normal)
leftBtn.titleLabel?.font = UIFont(name: "PingFangSC-Medium", size: 17)
changeCellSortView?.addSubview(leftBtn)
leftBtn.snp.makeConstraints { (make) in
make.left.bottom.equalTo(0)
make.height.equalTo(49)
make.width.equalTo(fullScreenWidth*0.5)
}
let rightBtn = UIButton()
rightBtn.addTarget(self, action: #selector(changeCellSortAc(sender:)), for: .touchUpInside)
rightBtn.tag = 1
rightBtn.backgroundColor = RGB(r: 53, g: 135, b: 219)
rightBtn.setTitle("确定", for: .normal)
rightBtn.titleLabel?.font = UIFont(name: "PingFangSC-Medium", size: 17)
changeCellSortView?.addSubview(rightBtn)
rightBtn.snp.makeConstraints { (make) in
make.left.equalTo(leftBtn.snp.right)
make.bottom.equalTo(0)
make.height.equalTo(49)
make.width.equalTo(fullScreenWidth*0.5)
}
let titleLbl = UILabel()
titleLbl.textAlignment = .center
titleLbl.text = "调整地址"
titleLbl.textColor = UIColor(named: "标题字颜色")
titleLbl.font = UIFont(name: "PingFangSC-Medium", size: 15)
changeCellSortView?.addSubview(titleLbl)
titleLbl.snp.makeConstraints { (make) in
make.top.left.right.equalTo(0)
make.height.equalTo(49)
}
let line = UIView()
line.backgroundColor = UIColor(named: "灰色分界线")
changeCellSortView?.addSubview(line)
line.snp.makeConstraints { (make) in
make.top.equalTo(titleLbl.snp.bottom)
make.left.right.equalTo(0)
make.height.equalTo(1)
}
let blueL = UILabel()
blueL.text = "发"
blueL.textColor = UIColor.white
blueL.backgroundColor = UIColor(named: "按钮背景颜色")
blueL.layer.cornerRadius = 11
blueL.textAlignment = .center
blueL.font = UIFont.systemFont(ofSize: 13)
blueL.layer.masksToBounds = true
changeCellSortView?.addSubview(blueL)
blueL.snp.makeConstraints { (make) in
make.width.height.equalTo(22)
make.left.equalTo(20)
make.top.equalTo(line.snp.bottom).offset(13.5)
}
let adrFisrtLbl = UILabel()
adrFisrtLbl.text = adrArr.first
adrFisrtLbl.textColor = UIColor(named: "标题字颜色")
adrFisrtLbl.font = UIFont.systemFont(ofSize: 13)
changeCellSortView?.addSubview(adrFisrtLbl)
adrFisrtLbl.snp.makeConstraints { (make) in
make.centerY.equalTo(blueL.snp.centerY)
make.left.equalTo(blueL.snp.right).offset(10)
make.right.equalTo(15)
make.height.equalTo(18.5)
}
let line2 = UIView()
line2.backgroundColor = UIColor(named: "灰色分界线")
changeCellSortView?.addSubview(line2)
line2.snp.makeConstraints { (make) in
make.top.equalTo(line.snp.bottom).offset(49)
make.left.equalTo(15)
make.right.equalTo(0)
make.height.equalTo(1)
}
let tbv = UITableView()
tbv.tag = 999
tbv.separatorStyle = .none
tbv.setEditing(true, animated:true)
tbv.delegate = self
tbv.dataSource = self
tbv.register(UINib(nibName: "ToFormChangeTableViewCell", bundle: nil), forCellReuseIdentifier: "ToFormChangeTableViewCell")
changeCellSortView?.addSubview(tbv)
tbv.snp.makeConstraints { (make) in
make.top.equalTo(line2.snp.bottom)
make.left.right.equalTo(0)
make.bottom.equalTo(leftBtn.snp.top)
}
}
}else{
print("添加")
}
}
@objc func changeCellSortAc(sender:UIButton){
changeCellSortView?.isHidden = true
closeBtn?.isHidden = true
if sender.tag == 0 {
print("左边")
}else{
print("右边")
}
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if tableView == listView { if tableView == listView {
if section == 0 { if section == 0 {
...@@ -516,13 +658,20 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -516,13 +658,20 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
} }
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
if tableView.tag == 999 {
return 1
}
if tableView == listView { if tableView == listView {
return 3 return 3
}else{//货拉拉 }else{//货拉拉
return 5 return 5
} }
} }
var adrArr:Array<String> = ["1","2","3","4","2","3","4","2","3","4","2","3","4","2","3","4","2","3","4"]
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView.tag == 999 {
return adrArr.count - 1
}
if tableView == listView { if tableView == listView {
switch section { switch section {
case 0:return 2 case 0:return 2
...@@ -531,7 +680,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -531,7 +680,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
}else{//货拉拉 }else{//货拉拉
switch section { switch section {
case 1:return 2 case 1:return adrArr.count
case 2:return 4 case 2:return 4
case 3:return 2 case 3:return 2
default: return 1 default: return 1
...@@ -650,6 +799,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -650,6 +799,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if tableView.tag == 999 {
return 49
}
if tableView == listView { if tableView == listView {
if indexPath.section == 0 { if indexPath.section == 0 {
if indexPath.row == 0 { if indexPath.row == 0 {
...@@ -684,6 +836,13 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -684,6 +836,13 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if tableView.tag == 999 {
let cell = tableView.dequeueReusableCell(withIdentifier: "ToFormChangeTableViewCell") as! ToFormChangeTableViewCell
cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
cell.titleLbl.text = self.adrArr[indexPath.row+1]
return cell
}
if tableView == listView { if tableView == listView {
switch indexPath.section { switch indexPath.section {
case 0: case 0:
...@@ -773,20 +932,21 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -773,20 +932,21 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
cell.iconLbl.layer.cornerRadius = 11 cell.iconLbl.layer.cornerRadius = 11
cell.lineTopView.isHidden = false cell.lineTopView.isHidden = false
cell.delBtn.isHidden = false cell.delBtn.isHidden = false
cell.addressDetailLbl.text = adrArr[indexPath.row]
if indexPath.row == 0 { if indexPath.row == 0 {
cell.addressDetailLbl.text = "" // cell.addressDetailLbl.text = ""
cell.namePhoneLbl.text = "" cell.namePhoneLbl.text = ""
cell.delBtn.isHidden = true cell.delBtn.isHidden = true
cell.iconLbl.text = "发" cell.iconLbl.text = "发"
cell.iconLbl.backgroundColor = UIColor.init(named: "蓝色字体颜色") cell.iconLbl.backgroundColor = UIColor.init(named: "蓝色字体颜色")
cell.lineTopView.isHidden = true cell.lineTopView.isHidden = true
}else{
cell.addressDetailLbl.text = "广东省广州市白云区嘉禾望岗白云大道交叉路口东南侧州市白云区嘉禾望岗白云大道交叉路口东南侧(望岗村民委员会西侧约150米))"
} }
// else{
// cell.addressDetailLbl.text = "广东省广州市白云区嘉禾望岗白云大道交叉路口东南侧州市白云区嘉禾望岗白云大道交叉路口东南侧(望岗村民委员会西侧约150米))"
// }
if indexPath.row != 4 && indexPath.row != 0 { if indexPath.row != adrArr.count - 1 && indexPath.row != 0 {
cell.iconLbl.text = "" cell.iconLbl.text = ""
cell.iconLbl.backgroundColor = UIColor.init(named: "虚线分界线颜色") cell.iconLbl.backgroundColor = UIColor.init(named: "虚线分界线颜色")
cell.iconW.constant = 12 cell.iconW.constant = 12
...@@ -794,7 +954,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -794,7 +954,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
cell.iconLbl.layer.cornerRadius = 6 cell.iconLbl.layer.cornerRadius = 6
} }
if indexPath.row == 4 { if indexPath.row == adrArr.count - 1 {
//最后的不显示lineview //最后的不显示lineview
cell.lineView.isHidden = true cell.lineView.isHidden = true
cell.iconLbl.text = "收" cell.iconLbl.text = "收"
...@@ -922,6 +1082,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -922,6 +1082,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
@objc func closeCarList(){ @objc func closeCarList(){
carListView?.isHidden = true carListView?.isHidden = true
cBtn?.isHidden = true cBtn?.isHidden = true
closeBtn?.isHidden = true
changeCellSortView?.isHidden = true
} }
@objc func selectAllCars(){ @objc func selectAllCars(){
cBtn?.isHidden = false cBtn?.isHidden = false
...@@ -1325,4 +1487,39 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1325,4 +1487,39 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
glSelectView = nil glSelectView = nil
} }
//单元格的编辑样式
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath)
-> UITableViewCell.EditingStyle {
return .none
}
//去除编辑模式下的头部缩进
func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt
indexPath: IndexPath) -> Bool {
return false
}
//在编辑状态,可以拖动设置cell位置
func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
return true
}
//移动cell事件
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath,
to destinationIndexPath: IndexPath) {
if sourceIndexPath != destinationIndexPath{
//获取移动行对应的值
let itemValue:String = adrArr[sourceIndexPath.row+1]
//删除移动的值
adrArr.remove(at: sourceIndexPath.row+1)
//如果移动区域大于现有行数,直接在最后添加移动的值
if destinationIndexPath.row+1 > adrArr.count{
adrArr.append(itemValue)
}else{
//没有超过最大行数,则在目标位置添加刚才删除的值
adrArr.insert(itemValue, at:destinationIndexPath.row+1)
}
}
}
} }
//
// HuoLaLaDiZhiCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/7/31.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class HuoLaLaDiZhiCell: UITableViewCell {
@IBOutlet weak var contentLbl: UILabel!
@IBOutlet weak var nameLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="206" id="KGk-i7-Jjw" customClass="HuoLaLaDiZhiCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="328" height="206"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="328" height="206"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SVj-as-s8v">
<rect key="frame" x="15" y="15" width="298" height="18.5"/>
<constraints>
<constraint firstAttribute="height" constant="18.5" id="X4e-gb-qKp"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3s8-3x-dnL">
<rect key="frame" x="15" y="205" width="313" height="1"/>
<color key="backgroundColor" name="灰色分界线"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="NXr-Wv-9vF"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xvf-JN-rSb">
<rect key="frame" x="15" y="38.5" width="298" height="151.5"/>
<attributedString key="attributedText">
<fragment content="Label">
<attributes>
<color key="NSColor" name="9A9A9A"/>
<font key="NSFont" metaFont="system"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" lineSpacing="3" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="3s8-3x-dnL" secondAttribute="trailing" id="24Y-o3-crE"/>
<constraint firstAttribute="bottom" secondItem="3s8-3x-dnL" secondAttribute="bottom" id="Blx-oo-mcC"/>
<constraint firstItem="xvf-JN-rSb" firstAttribute="top" secondItem="SVj-as-s8v" secondAttribute="bottom" constant="5" id="RhK-r4-M8n"/>
<constraint firstItem="SVj-as-s8v" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="WF1-iZ-ieb"/>
<constraint firstItem="SVj-as-s8v" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="goD-EA-cfh"/>
<constraint firstItem="xvf-JN-rSb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="jTf-fa-heK"/>
<constraint firstAttribute="trailing" secondItem="SVj-as-s8v" secondAttribute="trailing" constant="15" id="l0H-rf-a8U"/>
<constraint firstItem="3s8-3x-dnL" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="rSn-7l-jpO"/>
<constraint firstItem="3s8-3x-dnL" firstAttribute="top" secondItem="xvf-JN-rSb" secondAttribute="bottom" constant="15" id="yQs-Ud-Iuf"/>
<constraint firstAttribute="trailing" secondItem="xvf-JN-rSb" secondAttribute="trailing" constant="15" id="zMV-5p-xYy"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="contentLbl" destination="xvf-JN-rSb" id="xG8-yJ-JaO"/>
<outlet property="nameLbl" destination="SVj-as-s8v" id="jan-yT-jXv"/>
</connections>
<point key="canvasLocation" x="137.68115942028987" y="168.75"/>
</tableViewCell>
</objects>
<resources>
<namedColor name="9A9A9A">
<color red="0.60392156862745094" green="0.60392156862745094" blue="0.60392156862745094" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
...@@ -14,7 +14,23 @@ import MAMapKit ...@@ -14,7 +14,23 @@ import MAMapKit
import AMapSearchKit import AMapSearchKit
import IQKeyboardManagerSwift import IQKeyboardManagerSwift
class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLocationManagerDelegate, AMapSearchDelegate, UISearchBarDelegate, SearchBarViewDelegate { class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLocationManagerDelegate, AMapSearchDelegate, UISearchBarDelegate, SearchBarViewDelegate,UITableViewDelegate,UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "HuoLaLaDiZhiCell") as! HuoLaLaDiZhiCell
cell.nameLbl.text = "测试"
cell.contentLbl.text = "adasf"
if indexPath.row == 0 {
cell.contentLbl.text = "asfdasldfkj;alsjdf;lasjfasl;jfda;lskjfda;lsfjals;kfjasl;fjasl;fjasl;fjasl;fdjasl;fjaslfdjaslfdjaslfkjasfdlkajsflsajfdlk"
}
return cell
}
@IBOutlet weak var navBgView: UIView! @IBOutlet weak var navBgView: UIView!
@IBOutlet weak var citySelectBtn: UIButton! @IBOutlet weak var citySelectBtn: UIButton!
...@@ -28,6 +44,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -28,6 +44,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
@IBOutlet weak var sureSelectLbl: UILabel! @IBOutlet weak var sureSelectLbl: UILabel!
@IBOutlet weak var MapBgView: UIView! @IBOutlet weak var MapBgView: UIView!
@IBOutlet weak var selectListV: UITableView!
//高德地图 //高德地图
var mapView: MAMapView! var mapView: MAMapView!
var search: AMapSearchAPI! var search: AMapSearchAPI!
...@@ -86,35 +103,40 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -86,35 +103,40 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
searchBr.delegate = self searchBr.delegate = self
searchBr.delegateL = self searchBr.delegateL = self
selectListV.register(UINib(nibName: "HuoLaLaDiZhiCell", bundle: nil), forCellReuseIdentifier: "HuoLaLaDiZhiCell")
selectListV.separatorStyle = .none
AMapServices.shared().apiKey = "ca417b43e3d031db9c29382cc09a174a" AMapServices.shared().apiKey = "ca417b43e3d031db9c29382cc09a174a"
initMapView()
initSearch()
manger.delegate = self manger.delegate = self
manger.requestAlwaysAuthorization()
manger.requestWhenInUseAuthorization()
manger.startUpdatingLocation() manger.startUpdatingLocation()
} }
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { func initMapView(){
manger.stopUpdatingLocation()
let location = locations.last
lat = location?.coordinate.latitude as! CLLocationDegrees
lng = location?.coordinate.longitude as! CLLocationDegrees
initMapView(lat: lat, lng: lng)
initSearch()
}
func initMapView(lat:CLLocationDegrees,lng:CLLocationDegrees) {
AMapServices.shared().enableHTTPS = true AMapServices.shared().enableHTTPS = true
mapView = MAMapView(frame:MapBgView.bounds) mapView = MAMapView(frame:MapBgView.bounds)
mapView.delegate = self mapView.delegate = self
mapView.zoomLevel = 16 mapView.zoomLevel = 16
mapView.isZoomEnabled = true mapView.isZoomEnabled = true
mapView.setCenter(CLLocationCoordinate2D(latitude: lat, longitude: lng), animated: false)
MapBgView.addSubview(mapView!) MapBgView.addSubview(mapView!)
let tap = UITapGestureRecognizer(target: self, action: #selector(cancelKeyboard)) let tap = UITapGestureRecognizer(target: self, action: #selector(cancelKeyboard))
mapView.addGestureRecognizer(tap) mapView.addGestureRecognizer(tap)
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
manger.stopUpdatingLocation()
let location = locations.last
lat = location?.coordinate.latitude as! CLLocationDegrees
lng = location?.coordinate.longitude as! CLLocationDegrees
setMapCenter(lat: lat, lng: lng)
}
func setMapCenter(lat:CLLocationDegrees,lng:CLLocationDegrees) {
mapView.setCenter(CLLocationCoordinate2D(latitude: lat, longitude: lng), animated: false)
} }
@objc func cancelKeyboard(){ @objc func cancelKeyboard(){
...@@ -325,6 +347,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -325,6 +347,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
print("调起搜索后添加个蒙版本") print("调起搜索后添加个蒙版本")
closeBtn.isHidden = false closeBtn.isHidden = false
listViewBG.isHidden = false listViewBG.isHidden = false
return true return true
} }
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<outlet property="navBgView" destination="gLT-4M-bfs" id="fjx-Hf-4GS"/> <outlet property="navBgView" destination="gLT-4M-bfs" id="fjx-Hf-4GS"/>
<outlet property="phoneTF" destination="zpG-8r-dzl" id="nwC-VM-snC"/> <outlet property="phoneTF" destination="zpG-8r-dzl" id="nwC-VM-snC"/>
<outlet property="rightBtn" destination="pS2-lL-cUp" id="HGP-qi-64L"/> <outlet property="rightBtn" destination="pS2-lL-cUp" id="HGP-qi-64L"/>
<outlet property="selectListV" destination="FkD-95-sVW" id="wNv-R5-d7Z"/>
<outlet property="sureSelectLbl" destination="nZK-ad-fmq" id="5gq-Yd-d6B"/> <outlet property="sureSelectLbl" destination="nZK-ad-fmq" id="5gq-Yd-d6B"/>
<outlet property="toFormTitleLbl" destination="kjg-a9-QU1" id="8Fc-oo-P93"/> <outlet property="toFormTitleLbl" destination="kjg-a9-QU1" id="8Fc-oo-P93"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
...@@ -298,9 +299,13 @@ ...@@ -298,9 +299,13 @@
<action selector="backToUserLocation:" destination="-1" eventType="touchUpInside" id="fzl-eo-JNZ"/> <action selector="backToUserLocation:" destination="-1" eventType="touchUpInside" id="fzl-eo-JNZ"/>
</connections> </connections>
</button> </button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="FkD-95-sVW"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="FkD-95-sVW">
<rect key="frame" x="0.0" y="101.5" width="414" height="646.5"/> <rect key="frame" x="0.0" y="101.5" width="414" height="646.5"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="0q6-BW-cvc"/>
<outlet property="delegate" destination="-1" id="Abz-vu-2hp"/>
</connections>
</tableView> </tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="maR-I9-Ohr"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="maR-I9-Ohr">
<rect key="frame" x="0.0" y="50" width="206.5" height="2.5"/> <rect key="frame" x="0.0" y="50" width="206.5" height="2.5"/>
......
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