Commit ef254946 authored by lujunye's avatar lujunye

补充搜索功能

parent e26d340d
...@@ -82,7 +82,35 @@ class CGDListViewController: BaseViewController ,UISearchBarDelegate, SearchBar ...@@ -82,7 +82,35 @@ class CGDListViewController: BaseViewController ,UISearchBarDelegate, SearchBar
pagingViewController.didMove(toParent: self) pagingViewController.didMove(toParent: self)
pagingVC = pagingViewController pagingVC = pagingViewController
} }
//MARK:--搜索按钮代理
var keyword = ""
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
print("点击搜索进行--")
searchBar.resignFirstResponder()
keyword = searchBar.text!
viewControllers.forEach { (vc) in
vc.keyword = keyword
vc.isUpData = false
}
let vc = viewControllers[selectIndex]
vc.listView.mj_header?.beginRefreshing()
}
//MARK:--取消搜索代理
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
print("编辑即将结束了--")
removeBlackBtnView()
if searchBar.text?.count == 0 && keyword.count != 0{
keyword = searchBar.text!
viewControllers.forEach { (vc) in
vc.keyword = keyword
vc.isUpData = false
}
let vc = viewControllers[selectIndex]
vc.listView.mj_header?.beginRefreshing()
}
}
//MAKR:--调起搜索后添加个蒙版本 //MAKR:--调起搜索后添加个蒙版本
var blackBtnView:UIButton! = nil var blackBtnView:UIButton! = nil
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool { 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