I am trying to implement a tab bar application in which a tab is provided with Search bar.
When I click on the Search button after entering some data into the search field, I should get a tableview
displaying the search results. The tableview
should be added as a subview.
How should I implement this?
Asked
Active
Viewed 1.8k times
3

Maarten Bodewes
- 90,524
- 13
- 150
- 263

Ajit
- 101
- 1
- 2
- 8
4 Answers
3
You need to take a look at Apple's UISearchDisplayController class reference documentation - this covers precisely what you're attempting to do and contains a link to a sample project (see the "Related sample code" section at the top) if you require some example code to look at.

John Parker
- 54,048
- 11
- 129
- 129
3
UISearchBar is a control in toolbox, you need to implement it, and implement search button press event to add tableview as a subview.
you can consult with the similar thread here

Community
- 1
- 1

Waqas Raja
- 10,802
- 4
- 33
- 38
1
Here you go: http://ved-dimensions.blogspot.com/2009/02/iphone-development-adding-search-bar-in.html

woodleader
- 923
- 1
- 5
- 14
0
You will have to create two different tables
- One for showing all values.
- Second For showing searched result.
and implement these two delegates of UISearchBarDelegate,UISearchDisplayDelegate
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption