Commit 6bf7bb93 authored by lujunye's avatar lujunye

阿斯顿后方可拉屎的领福卡欢乐书客的

parent 9ce015e2
......@@ -11,6 +11,7 @@ import UIKit
class SJMapCell: UITableViewCell {
var lat:CGFloat?
var lng:CGFloat?
var cityData = ""
@IBOutlet weak var imgView: UIImageView!
@IBOutlet weak var contentLbl: UILabel!
@IBOutlet weak var nameLbl: UILabel!
......
......@@ -94,6 +94,10 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
name: UIResponder.keyboardWillHideNotification, object: nil)
}
var isSearchMode = false
var reloadOnce = false
var closeBtn:UIButton?
//键盘弹出监听
@objc func keyboardShow(note: Notification) {
guard let userInfo = note.userInfo else {return}
......@@ -101,33 +105,74 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
//获取动画执行的时间
var duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double
if duration == nil { duration = 0.25 }
isSearchMode = true
var btmH = 255
if IS_IPHONE_X {
btmH = 289
}
var btnH = 49
if IS_IPHONE_X {
btnH = 83
}
//获取键盘弹起的高度
print(keyboardRect.height)
btmView.snp.updateConstraints { (make) in
make.bottom.equalTo(-keyboardRect.height)
make.left.right.equalTo(0)
make.height.equalTo(btmH)
make.height.equalTo(btmH-btnH)
}
btmTitle?.isHidden = true
btmBtn?.isHidden = true
listView?.frame = btmView.bounds
if reloadOnce == false {
reloadOnce = true
listView?.reloadData()
}
if closeBtn == nil {
let btn = UIButton()
btn.backgroundColor = UIColor.black
btn.alpha = 0.4
self.view.addSubview(btn)
btn.addTarget(self, action: #selector(searchClose(btn:)), for: .touchUpInside)
btn.snp.makeConstraints { (make) in
make.top.equalTo(NavHeight)
make.left.right.equalTo(0)
make.bottom.equalTo(btmView.snp_top)
}
closeBtn = btn
}
}
@objc func searchClose(btn:UIButton){
isSearchMode = false
reloadOnce = false
btn.removeFromSuperview()
closeBtn = nil
listView?.reloadData()
IQKeyboardManager.shared.resignFirstResponder()
}
@objc func keyboardHidden(note: Notification){
var btmH = 255
if IS_IPHONE_X {
btmH = 289
}
// isSearchMode = false
//获取键盘弹起的高度
btmView.snp.updateConstraints { (make) in
make.bottom.equalTo(0)
make.left.right.equalTo(0)
make.height.equalTo(btmH)
}
var btnH = 49
if IS_IPHONE_X {
btnH = 83
}
listView?.frame = CGRect(x: 0, y: 0, width: Int(ScreenWidth), height: btmH-btnH)
btmTitle?.isHidden = false
btmBtn?.isHidden = false
}
deinit {
......@@ -245,7 +290,7 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
let poi = adrArr[indexPath.row]
cell.nameLbl.text = poi.name
cell.cityData = poi.province + "-" + poi.city + "-" + poi.district
//1.将两个经纬度点转成投影点
let point1 = MAMapPointForCoordinate(CLLocationCoordinate2D(latitude: lat, longitude: lng))
let point2 = MAMapPointForCoordinate(CLLocationCoordinate2D(latitude: CLLocationDegrees(poi.location!.latitude), longitude: CLLocationDegrees(poi.location!.longitude)))
......@@ -257,17 +302,22 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
cell.lat = poi.location.latitude
cell.lng = poi.location.longitude
cell.imgView.isHidden = true
if indexPath == idx {
if isSearchMode == false {
cell.imgView.isHidden = false
}
adrStr = poi.name
cityData = poi.province + "-" + poi.city + "-" + poi.district
}
return cell
}
var cityData:String?
var adrStr:String?
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath.row)
if idx == indexPath {
return
}else{
......@@ -276,10 +326,17 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
mapView.setCenter(CLLocationCoordinate2D(latitude:CLLocationDegrees(cell.lat!), longitude: CLLocationDegrees(cell.lng!)), animated: false)
listView?.reloadData()
adrStr = cell.nameLbl.text
print("abc == ",isSearchMode)
if isSearchMode {
print("abc == ")
delegate?.SJMapViewControllerSelectArd(adr: cell.nameLbl.text!, cityData: cell.cityData)
self.navigationController?.popViewController(animated: true)
}
}
}
var btmTitle:UILabel?
var btmBtn:LGButton?
func initBtmView(view:UIView){
let tbv = UITableView()
tbv.separatorStyle = .none
......@@ -291,14 +348,17 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
if IS_IPHONE_X {
btnH = 83
}
tbv.snp.makeConstraints { (make) in
make.top.left.right.equalTo(0)
make.bottom.equalTo(btnH * -1)
var btmH = 255
if IS_IPHONE_X {
btmH = 289
}
tbv.frame = CGRect(x: 0, y: 0, width: Int(ScreenWidth), height: btmH-btnH)
listView?.register(UINib(nibName: "SJMapCell", bundle: nil), forCellReuseIdentifier: "SJMapCell")
let submit_btn = LGButton()
view.addSubview(submit_btn)
btmBtn = submit_btn
submit_btn.gradientStartColor = UIColor(named: "按钮渐变色上")
submit_btn.gradientEndColor = UIColor(named: "按钮渐变色下,字体颜色")
submit_btn.gradientHorizontal = true
......@@ -313,6 +373,7 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
}
let lbl = UILabel()
btmTitle = lbl
view.addSubview(lbl)
lbl.textAlignment = .center
lbl.font = UIFont(name: "PingFangSC-Medium", size: 17)
......@@ -327,7 +388,7 @@ class SJMapViewController: UIViewController,NavBarViewDelegate,AMapLocationManag
let locationM = AMapLocationManager()
var btmView = UIView()
func initMapView(lat:CLLocationDegrees,lng:CLLocationDegrees) {
btmView.backgroundColor = UIColor.white
self.view.addSubview(btmView)
var btmH = 255
if IS_IPHONE_X {
......
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