我在tablview标题中有一个searchcontroller,但看起来tableview索引在右边引起了额外的填充。如何让searchcontroller文本字段中的左右填充相同?
var controller = UISearchController(searchResultsController: nil)
self.controller = ({
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.hidesNavigationBarDuringPresentation = false
controller.loadViewIfNeeded()
controller.delegate = self
let textFieldInsideSearchBar = controller.searchBar.value(forKey: "searchField") as? UITextField
textFieldInsideSearchBar?.leftViewMode = .always
textFieldInsideSearchBar?.backgroundColor = "e8e8e9".hexColor
textFieldInsideSearchBar?.rightViewMode = UITextFieldViewMode.whileEditing
textFieldInsideSearchBar?.leftViewMode = UITextFieldViewMode.never
controller.searchBar.barTintColor = "f6f6f6".hexColor
self.tableView.tableHeaderView = controller.searchBar
return controller
})()