實際上,我在表格視圖中存儲了太多數據,現在我想輕鬆找到我的數據,因此我需要一個搜索欄。任何人都可以給我一點解決方案嗎?如何在表格視圖中添加搜索欄
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [array count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifire = @"CellIdentifire";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifire];
}
cell.textLabel.text = [array objectAtIndex:indexPath.row];
return cell;
}
感謝所有,但我發現我的答案,如果你需要請嘗試「URL」 http://www.appcoda.com/how-to-add-search-bar-uitableview/ – 2014-10-28 15:22:54