Search code examples
iosobjective-cuisearchbaruisearchcontroller

How to expand the height of search bar text field for multiple items search using UISearchController?


I'm using Default UISearchController, and I want a search bar using which we can do multiple selections.

But there the text field height should grow when we enter multiple searches rather than showing in single line.

That means it should work like a textview where if it reaches the end of text field it should start in next line. How to implement this ? And which is the best way of doing this ? (If possible could you please write some lines of code in Objective -C)


Solution

  • Here is a solution but no sample code. Firstly, add UISearchController and its view to a parent view controller. Secondly, add a text view covers search bar of UISearchController. Thirdly,every time text view changes its text and frame, change text of search bar and adjust the frame of UISearchController view to keep text view covers search bar.