Last active
August 29, 2015 13:58
-
-
Save oliverfoggin/10024117 to your computer and use it in GitHub Desktop.
Failing UISearchDisplayController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "UserSearchViewController.h" | |
@interface UserSearchViewController () <UISearchBarDelegate, UISearchDisplayDelegate> | |
@end | |
@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]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment