1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// GYS_HZ_Vc.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/11/3.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_GuanLi_CellDelegate{
func GYS_GuanLi_CellStopAction(idx:Int) {
print("target = ",idx)
}
var keyword = ""
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
print("点击搜索进行--")
searchBar.resignFirstResponder()
keyword = searchBar.text!
}
//MARK:--取消搜索代理
func clearSearchAction() {
print("取消搜索代理了--")
}
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
print("编辑即将结束了--")
if searchBar.text?.count == 0 && keyword.count != 0{
keyword = searchBar.text!
}
print("key - ",searchBar.text!)
}
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
print("调起搜索后添加个蒙版本")
return true
}
var title_str = ""
weak var searchV: SearchBarView? = nil
@IBOutlet weak var search_view: UIView!
@IBOutlet weak var home_list_tbv: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
SetTopFrame(view: search_view, height: 44)
navbar.title = title_str
self.view.addSubview(navbar)
let searchBr = SearchBarView.init()
searchV = searchBr
var holder_str = "请输入供应商名称"
if title_str == "分销商管理" {
navbar.rightTitle = "新增店铺"
// holder_str = "请输入供应商名称"
}
searchBr.placeholderStr = holder_str
self.search_view.addSubview(searchBr)
searchV?.changecornerRadius(cornerRadius: 35*0.5)
searchBr.delegate = self
searchBr.delegateL = self
searchBr.snp.makeConstraints { (make) in
make.left.equalTo(0)
make.right.equalTo(0)
make.centerY.equalToSuperview()
make.height.equalTo(35)
}
home_list_tbv.register(UINib(nibName: "GYS_GuanLi_Cell", bundle: nil), forCellReuseIdentifier: "GYS_GuanLi_Cell")
home_list_tbv.separatorStyle = .none
// Do any additional setup after loading the view.
}
//MARK: - tableview_delegate
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_GuanLi_Cell") as! GYS_GuanLi_Cell
cell.delegate = self
if title_str == "分销商管理" {
cell.isFenXiaoShang = true
}
cell.tag = indexPath.row
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 148
}
}