在iPhone SDK中是否有任何简单的方法来包含像iPod应用程序或通讯录应用程序中的搜索栏? (他们的行为,并期待不同于通常UISearchBars ...)UITableView搜索栏?
- RY
在iPhone SDK中是否有任何简单的方法来包含像iPod应用程序或通讯录应用程序中的搜索栏? (他们的行为,并期待不同于通常UISearchBars ...)UITableView搜索栏?
- RY
查看UISearchDisplayController。它处理搜索栏的重新定位,屏幕的灰色等等,等等。
UIViewController有一个UISearchDisplayController属性,所以它很容易连接起来。还有TableSearch示例代码。
这增加了一个搜索栏,以表视图作为标题视图。这意味着它与表格视图一起滚动:
- (void) viewDidLoad
{
[super viewDidLoad];
UISearchBar* searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake(0, 0, 320, 45)];
if (searchBar != nil) {
// Your UISearchBar specifics here
self.tableView.tableHeaderView = searchBar;
}
}
酷!这正是我所期待的,谢谢! – ryyst 2010-03-16 20:03:27