3

I have uisearchbar in a uiview which is already subview of a uiviewController, I want to show the search bar in full screen when search bar is edited, i need to show the searching event in full screen, how to do this? here is my screen enter image description here here i have added search bar to the tableview header view and table view is already having header view, this search bar is covering my first element in table view,

how to start table view after search bar ended?

Charan
  • 4,940
  • 3
  • 26
  • 43

1 Answers1

1

You can make your class a UISearchDisplayDelegate and implement the hiding/moving of the search bar in the searchDisplayControllerDidEndSearch: method. To show the search bar in fullscreen, your class should implement the UISearchBarDelegate protocol and the searchBarShouldBeginEditing: function in particular.

Alexander
  • 8,117
  • 1
  • 35
  • 46
  • Can you post some example code for this? . I'm not sure how to implement it – Charan Mar 28 '12 at 06:50
  • There is a nice tutorial [here](http://jduff.github.com/2010/03/01/building-a-searchview-with-uisearchbar-and-uitableview/), it's not really related, but implements other delegate methods. In the apple developer network you can see the other methods that you would want to use ([here](http://developer.apple.com/library/ios/#documentation/uikit/reference/UISearchBarDelegate_Protocol/Reference/Reference.html) and [here](http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UISearchDisplayDelegate_Protocol/Reference/Reference.html). – Alexander Mar 28 '12 at 06:55
  • And i have other question also,here i have added search bar to the tableview header view and table view is already having header view i.e title "Mosques" , this search bar is covering my first object in table view,but actually my table view is having 4 objects, but in image u can see only 3 objects. – Charan Mar 28 '12 at 06:59
  • Add it on top of your table, not as a header view. It seems to me that the 'Mosques' title is your header view and the search bar is just lying on top of the table. – Alexander Mar 28 '12 at 07:04
  • ok, i have added search bar to top of my table, even after doing that search bar is overlapping/ covering my first object, should i do anything with CGRect – Charan Mar 28 '12 at 07:06
  • 1
    Try setting the search bar as a tableHeaderView from the code and set the search bar's height in the `tableView:heightForHeaderInSection:` delegate function. – Alexander Mar 28 '12 at 07:12
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/9392/discussion-between-sree-charan-and-alexander) – Charan Mar 28 '12 at 08:32