Commit 9e4bd83f authored by lujunye's avatar lujunye

输入搜索实现

parent aa6d427a
......@@ -20,12 +20,15 @@ protocol ToAndFormSelectViewControllerDelegate {
class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLocationManagerDelegate, AMapSearchDelegate, UISearchBarDelegate, SearchBarViewDelegate,UITableViewDelegate,UITableViewDataSource,CityListViewControllerDelegate,HuoLaLaDiZhiCellDelegate{
func HuoLaLaDiZhiCellBtnClick(model: citySearchDataPoiChildrenModel,cityStr:String) {
citySelectBtn.setTitle(cityStr, for: .normal)
mapView.centerCoordinate = CLLocationCoordinate2DMake((model.location?.lat)!,(model.location?.lon)!)
mapView.centerCoordinate = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02((model.location?.lon)!, andLat: (model.location?.lat)!) as! CLLocationCoordinate2D
isMove = false
adrName = model.name!
detailAdr = model.address!
searchList.isHidden = true
closeBtn.isHidden = true
listViewBG.isHidden = true
IQKeyboardManager.shared.resignFirstResponder()
print("1")
}
func CityListViewControllerLocSelect(loc: cityListDataModel) {
......@@ -196,7 +199,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
// searchBr.returnKeyType = .done
searchBr.returnKeyType = .done
if idx != 0 {
sureSelectLbl.text = "确认收货地"
......@@ -503,10 +506,18 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
}
searchBar.resignFirstResponder()
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
keyword = searchText
if keyword.count > 0 {
searchList.isHidden = false
let dict = ["user_token":UserToken as Any,
"nonce_str":String.randomStr(len: 30) as Any,
"kw":keyword as Any
]
citySearch(dict, success: { (data) in
let model = data as! citySearchModel
self.searchAdrDatas.removeAll()
......@@ -520,10 +531,9 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
}) { (err) in
}
}else{
searchList.isHidden = true
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
// keyword = searchText
}
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
......
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