在导航栏下添加搜索栏?

3
我想在导航栏下面添加一个带有uitableview的搜索栏。我想从数据库中进行搜索。你有什么好的方法吗?
1个回答

8
将搜索栏添加为表格的headerView。
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];

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接