Swift 带iBearchBar的UISearchController

Swift 带iBearchBar的UISearchController,swift,uisearchbar,uisearchcontroller,Swift,Uisearchbar,Uisearchcontroller,我正在尝试使用IBMUISearchBar进行tableView搜索 下面是代码 var resultSearchController = UISearchController() self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil) controller.searchResultsUpdater = self

我正在尝试使用IBMUISearchBar进行tableView搜索 下面是代码

var resultSearchController = UISearchController()

self.resultSearchController = ({
        let controller = UISearchController(searchResultsController: nil)
        controller.searchResultsUpdater = self
        controller.dimsBackgroundDuringPresentation = false
        controller.searchBar.sizeToFit()   
        self.tableView.tableHeaderView = controller.searchBar //not this way
        //IBSearchBar = controller.searchBar (this is a IBOutlet Searchbar which I wanted to use instead of adding search bar from program)
        return controller
    })()
我遵循这个URL:并尝试使用interface builder中的seachbar实现

当我以编程方式添加searchbar时,一切委托方法都会被调用,但如果我尝试使用IBMSearchBar进行设置,则不会调用委托方法

请建议