【发布时间】:2011-01-11 10:35:12
【问题描述】:
我正在尝试实现 UISearch 栏,但我遇到了一些问题。 当应用程序启动时,我添加这样的表格视图:
ChannelTableViewRootController *firstViewController = [[ChannelTableViewRootController alloc] initWithStyle:UITableViewStylePlain];
navigationController = [[UINavigationController alloc]initWithRootViewController:firstViewController];
navigationController.navigationBar.hidden = NO;
UIView *uv = self.view;
[uv addSubview:[navigationController view]];
我在 xib 中添加 UISearch 栏。从我的头文件将它连接到 UISearchBar 变量。将delegate设置为self,并尝试将其添加到tableview的header中:
self.tableView.tableHeaderView = searchBar;
searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
当我手动创建对象“searchBar = [[UISearchBar alloc]init]; // + code from above”时,我得到了像图像一样显示的搜索栏,但没有任何反应,也无法将其放在该标题上。我正在尝试在具有范围等的地址簿中进行搜索。
【问题讨论】:
标签: iphone objective-c uitableview uisearchbar