Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Failing UISearchDisplayController
#import "UserSearchViewController.h"
@interface UserSearchViewController () <UISearchBarDelegate, UISearchDisplayDelegate>
@implementation UserSearchViewController
- (void)viewDidLoad
[super viewDidLoad];
self.searchDisplayController.displaysSearchBarInNavigationBar = YES;
// create 10 rows that display the row number.
// no data source atm for the minimum failing test
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
return 10;
// just display the row number
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.textLabel.text = [NSString stringWithFormat:@"%ld", (long)indexPath.row];
return cell;
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment