ios - UISearchController does not trigger delegate methods and search bar delegate methods -


so have uisearchcontroller, shows bar, can enter text not trigger delegate methods. here code:

@ibaction func searchtapped(anyobject) {      nslog("search...")      let cancelbutton = uibarbuttonitem(image: uiimage(named: "delete_sign-50"), landscapeimagephone: nil, style: .plain, target: self, action: "canceltapped:")      var searchcontroller = uisearchcontroller(searchresultscontroller: nil)     searchcontroller.dimsbackgroundduringpresentation = false     searchcontroller.searchbar.placeholder = "enter text search"     searchcontroller.searchresultsupdater = self;     searchcontroller.hidesnavigationbarduringpresentation = false     searchcontroller.delegate = self     searchcontroller.searchbar.delegate = self      self.definespresentationcontext = true;       uiview.animatewithduration(0.2, animations: { () -> void in          self.navigationitem.rightbarbuttonitems = nil         self.navigationitem.rightbarbuttonitems = [cancelbutton]         self.navigationitem.titleview = searchcontroller.searchbar         searchcontroller.searchbar.sizetofit()         self.toolbar.hidden = false         self.tableview?.hidden = false     })      //add first responser search bar     searchcontroller.searchbar.becomefirstresponder()  }  func updatesearchresultsforsearchcontroller(searchcontroller: uisearchcontroller) {      nslog("1 %@", searchcontroller.searchbar.text);  }  func searchbar(searchbar: uisearchbar, shouldchangetextinrange range: nsrange, replacementtext text: string) -> bool {     nslog("2 %@", text)     return true } 

none of these methods getting called when text changes.

more that, tried adding searchcontroller variable controller, , in case works bonkers - when tap search bar moves off screen.

searchcontroller.active = yes; 

this helped, not sure why not mentioned anywhere.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -