Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [airportList count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ci"];
- Details *newDetails = [airportList objectAtIndex:indexPath.row];
- cell.textLabel.text = newDetails.airport;
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- Details *newDetails = [airportList objectAtIndex:indexPath.row];
- NSString *selectedText = newDetails.airport;
- [[NSUserDefaults standardUserDefaults] setObject:selectedText forKey:@"st"];
- [[NSUserDefaults standardUserDefaults] synchronize];
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- @property (strong, nonatomic) UISearchController *searchController;
- self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
- self.searchController.searchResultsUpdater = self;
- self.searchController.dimsBackgroundDuringPresentation = NO;
- self.searchController.searchBar.delegate = self;
- self.tableView.tableHeaderView = self.searchController.searchBar;
- self.definesPresentationContext = YES;
- - (void)updateSearchResultsForSearchController:(UISearchController *)searchController
- {
- NSString *searchString = searchController.searchBar.text;
- [self searchForText:searchString scope:searchController.searchBar.selectedScopeButtonIndex];
- [self.tableView reloadData];
- }
Add Comment
Please, Sign In to add comment