Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Uitableview 如何通过在搜索栏上键入时可以搜索其名称或字母的搜索来获取my tableviewcell中的项目?_Uitableview_Search_Swift3_Uiviewcontroller - Fatal编程技术网

Uitableview 如何通过在搜索栏上键入时可以搜索其名称或字母的搜索来获取my tableviewcell中的项目?

Uitableview 如何通过在搜索栏上键入时可以搜索其名称或字母的搜索来获取my tableviewcell中的项目?,uitableview,search,swift3,uiviewcontroller,Uitableview,Search,Swift3,Uiviewcontroller,类RevenueListViewController:UIViewController{ var filterRevenueList = [RevenueThisCycleListModelProtocol]() var output: RevenueThisCycleListViewOutput? var listRevenue: [RevenueThisCycleListModelProtocol] = [] @IBOutlet weak var searchRevenueList: Se

类RevenueListViewController:UIViewController{

var filterRevenueList = [RevenueThisCycleListModelProtocol]()
var output: RevenueThisCycleListViewOutput?
var listRevenue: [RevenueThisCycleListModelProtocol] = []

@IBOutlet weak var searchRevenueList: SearchTextFieldWithDarkIcon!
@IBOutlet weak var tableViewRevenueList: UITableView!

override func viewDidLoad() {
    super.viewDidLoad()

    searchRevenueList.textField.placeholder = "Search"
    searchRevenueList.textField.addTarget(self, action: #selector(didSearchTextFieldChanged(_:)), for: .editingChanged)
    tableViewRevenueList.dataSource = self
    tableViewRevenueList.delegate = self
    
    
    tableViewRevenueList.register(UINib(nibName: "TopSLTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "TopSLTableViewCell")
    tableViewRevenueList.register(UINib(nibName: "TopSLSectionTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "TopSLSectionTableViewCell")

    output?.viewWillAppear(view: self)
}

@objc fileprivate func didSearchTextFieldChanged(_ sender: UITextField) {
    
    
}
}

扩展RevenueListViewController:UITableViewDataSource{

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return listRevenue.count
}

}

我已经有一个搜索栏,它有一个操作,它必须有一个方法在里面,以获得我的tableviewcell中的项目。谢谢你的帮助

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    
    let cell = tableViewRevenueList.dequeueReusableCell(withIdentifier: "TopSLTableViewCell") as! TopSLTableViewCell
    let revenue = listRevenue[indexPath.row]
    cell.configure(revenue: revenue, cellForItemAt: indexPath.row)
    return cell
    
    }

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    
    let cell = tableViewRevenueList.dequeueReusableCell(withIdentifier: "TopSLSectionTableViewCell")
    return cell
}