adding search bar under the navigation bar?

cocoa-touch, iphone, objective-c

Solution

add the searchbar as the headerView for your table.

UISearchBar *temp = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, 320, 45)];
temp.barStyle=UIBarStyleBlackTranslucent;
temp.showsCancelButton=YES;
temp.autocorrectionType=UITextAutocorrectionTypeNo;
temp.autocapitalizationType=UITextAutocapitalizationTypeNone;
temp.delegate=self;
self.tableView.tableHeaderView=temp;
[temp release];

Problem

i want to add a search bar under the navigation bar with uitableview. and i want to search from the database? any idea how to do this

Original source