inputview에서 tableview를 표시하고 select에서 값을 반환하는 텍스트 필드가 있습니다. 그러나 tablebar에 표제어를 추가했지만 문제는 검색 표시기 표보기를 탭하면 자동으로 닫히고 다시 열리는 것을 의미합니다. 캔트조차 검색 창을 클릭하십시오. 어떤 충고?검색 막대가 inputView로 검색 표시 줄이있는 UITableView
다음은 코드입니다.
class myClass: UIViewController, UITableViewDataSource, UITableViewDelegate, UINavigationBarDelegate, UISearchBarDelegate {
//the all are in viewdidload
var tableView: UITableView = UITableView()
tableView = UITableView(frame: UIScreen.mainScreen().bounds, style: UITableViewStyle.Plain)
tableView.delegate = self
tableView.dataSource = self
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
let navigationBar = UINavigationBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 44))
let navigationItem = UINavigationItem()
var searchBar:UISearchBar = UISearchBar()
searchBar.searchBarStyle = UISearchBarStyle.Prominent
searchBar.placeholder = " Search..."
searchBar.sizeToFit()
searchBar.translucent = false
searchBar.backgroundImage = UIImage()
searchBar.delegate = self
navigationBar.items = [navigationItem]
tableView.tableHeaderView = navigationBar
toTextField.inputView = self.tableView
}