ios - displaysSearchBarInNavigationBar deprecated in iOS8 -


i'm trying find alternative displayssearchbarinnavigationbar ios8, there can use (in swift)?

i tried self.navigationitem.titleview = resultsearchcontroller.searchbar doesn't anything.

i don't understand how find replacement functions deprecated, on apple documentation deprecated no alternative, if have tips appreciated.

you can put uisearchbar in uinavigationbar without using uinavigationcontroller without problem, have minor change only, first need define @iboutlet uinavigationitem inside uinavigationbar name need different navigationitem property defined in uiviewcontroller class, see following code:

class viewcontroller: uiviewcontroller, uisearchcontrollerdelegate, uisearchresultsupdating, uisearchbardelegate {      var searchcontroller : uisearchcontroller!      @iboutlet weak var navigationitembar: uinavigationitem!      override func viewdidload() {        super.viewdidload()         self.searchcontroller = uisearchcontroller(searchresultscontroller:  nil)         self.searchcontroller.searchresultsupdater = self        self.searchcontroller.delegate = self        self.searchcontroller.searchbar.delegate = self         self.searchcontroller.hidesnavigationbarduringpresentation = false        self.searchcontroller.dimsbackgroundduringpresentation = true         self.navigationitembar.titleview = searchcontroller.searchbar         self.definespresentationcontext = true             }      func updatesearchresultsforsearchcontroller(searchcontroller: uisearchcontroller) {      }      override func didreceivememorywarning() {        super.didreceivememorywarning()        // dispose of resources can recreated.     } } 

and can see in simulator:

enter image description here

i hope you.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -