开发者

How to implement search bar in iPhone? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago.

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开发者_Python百科 implement this?


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

UISearchBar Sample Code


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.


Here you go: http://ved-dimensions.blogspot.com/2009/02/iphone-development-adding-search-bar-in.html


You will have to create two different tables

  1. One for showing all values.
  2. 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜