swift2 - tvOS: A way to have UISearchController not appear as a button? -


this code

var searchcontroller: uisearchcontroller! @iboutlet weak var collectionview: uicollectionview!  override func viewdidload() {     super.viewdidload()      searchcontroller = uisearchcontroller(searchresultscontroller: nil)     searchcontroller.searchresultsupdater = self     searchcontroller.obscuresbackgroundduringpresentation = false     view.addsubview(searchcontroller.searchbar)     getitems() } 

produces this: screeshot1

note searchbar appears button stuck in upper left (because tabbed app appears under tab bar when first presented. "button" button there receive focus testing).

this how looks after pressing button: screenshot2

the second image shows how things when search tab opens, , way though supposed in tvos.

how searchcontroller appear in second screenshot? many tvos apps this, know must possible. have been on documentation carefully, must have missed something.

a related issue collectionview below won't take focus searchcontroller. 1 has go using remote menu button collectionview focus.

how can searchcontroller appear in second screenshot when view appears?

how can collectionview take focus searchcontroller without having go tab bar?

is ran across passage in tvos developer library

all of ios first responder mechanisms work on tvos. allows developers present ui, visible or hidden, , make 1 of text fields first responder calling becomefirstresponder method on it. action causes text field put keyboard ui without user having navigate text field , click on it.

so, adding

searchcontroller.searchbar.becomefirstresponder() 

displays inline keyboard wanted users start with. however, 1 has press menu button on remote before focus engine kicks in again. menu button dismisses keyboard , searchbar returns button state.

this answer first of questions. still clueless second.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -