// // MyTableViewController.m // UISearchDisplayController // // Created by Phillip Harris on 4/19/14. // Copyright (c) 2014 Phillip Harris. All rights reserved. // #import "ChatConversationSearchTableView.h" @interface ChatConversationSearchTableView () @property(nonatomic, strong) NSArray *names; @property(nonatomic, strong) NSArray *searchResults; @end @implementation ChatConversationSearchTableView //=============================================== #pragma mark - #pragma mark Initialization //=============================================== - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { [self commonInit]; } return self; } - (instancetype)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { [self commonInit]; } return self; } - (void)commonInit { _names = @[ @"Aaliyah", @"Aaron", @"Abigail", @"Adam", @"Addison", @"Adrian", @"Aiden", @"Alex", @"Alexa", @"Alexander", @"Alexandra", @"Alexis", @"Allison", @"Alyssa", @"Amelia", @"Andrea", @"Andrew", @"Angel", @"Anna", @"Annabelle", @"Anthony", @"Aria", @"Ariana", @"Arianna", @"Ashley", @"Aubree", @"Aubrey", @"Audrey", @"Austin", @"Autumn", @"Ava", @"Avery", @"Ayden", @"Bailey", @"Bella", @"Benjamin", @"Bentley", @"Blake", @"Brandon", @"Brayden", @"Brianna", @"Brody", @"Brooklyn", @"Bryson", @"Caleb", @"Cameron", @"Camila", @"Carlos", @"Caroline", @"Carson", @"Carter", @"Charles", @"Charlotte", @"Chase", @"Chloe", @"Christian", @"Christopher", @"Claire", @"Colton", @"Connor", @"Cooper", @"Damian", @"Daniel", @"David", @"Dominic", @"Dylan", @"Easton", @"Eli", @"Elijah", @"Elizabeth", @"Ella", @"Ellie", @"Emily", @"Emma", @"Ethan", @"Eva", @"Evan", @"Evelyn", @"Faith", @"Gabriel", @"Gabriella", @"Gavin", @"Genesis", @"Gianna", @"Grace", @"Grayson", @"Hailey", @"Hannah", @"Harper", @"Henry", @"Hudson", @"Hunter", @"Ian", @"Isaac", @"Isabella", @"Isaiah", @"Jace", @"Jack", @"Jackson", @"Jacob", @"James", @"Jasmine", @"Jason", @"Jaxon", @"Jayden", @"Jeremiah", @"Jocelyn", @"John", @"Jonathan", @"Jordan", @"Jose", @"Joseph", @"Joshua", @"Josiah", @"Juan", @"Julia", @"Julian", @"Justin", @"Katherine", @"Kayden", @"Kayla", @"Kaylee", @"Kennedy", @"Kevin", @"Khloe", @"Kimberly", @"Kylie", @"Landon", @"Lauren", @"Layla", @"Leah", @"Levi", @"Liam", @"Lillian", @"Lily", @"Logan", @"London", @"Lucas", @"Lucy", @"Luis", @"Luke", @"Lydia", @"Mackenzie", @"Madeline", @"Madelyn", @"Madison", @"Makayla", @"Mason", @"Matthew", @"Maya", @"Melanie", @"Mia", @"Michael", @"Molly", @"Morgan", @"Naomi", @"Natalie", @"Nathan", @"Nathaniel", @"Nevaeh", @"Nicholas", @"Noah", @"Nolan", @"Oliver", @"Olivia", @"Owen", @"Parker", @"Peyton", @"Piper", @"Reagan", @"Riley", @"Robert", @"Ryan", @"Ryder", @"Samantha", @"Samuel", @"Sarah", @"Savannah", @"Scarlett", @"Sebastian", @"Serenity", @"Skylar", @"Sofia", @"Sophia", @"Sophie", @"Stella", @"Sydney", @"Taylor", @"Thomas", @"Trinity", @"Tristan", @"Tyler", @"Victoria", @"Violet", @"William", @"Wyatt", @"Xavier", @"Zachary", @"Zoe", @"Zoey" ]; } //=============================================== #pragma mark - #pragma mark View Methods //=============================================== - (void)viewDidLoad { [super viewDidLoad]; [self configureTableView:self.tableView]; } //=============================================== #pragma mark - #pragma mark Helper //=============================================== - (void)configureTableView:(UITableView *)tableView { // tableView.separatorInset = UIEdgeInsetsZero; [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellId"]; UIView *tableFooterViewToGetRidOfBlankRows = [[UIView alloc] initWithFrame:CGRectZero]; tableFooterViewToGetRidOfBlankRows.backgroundColor = [UIColor clearColor]; tableView.tableFooterView = tableFooterViewToGetRidOfBlankRows; } //=============================================== #pragma mark - #pragma mark UITableView //=============================================== - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // if (tableView == self.tableView) { return [self.names count]; // } else { // return [self.searchResults count]; // } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath]; // NSString *name = (tableView == self.tableView) ? self.names[indexPath.row] : self.searchResults[indexPath.row]; // // cell.textLabel.text = name; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; } #pragma mark - searchBar delegate - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { // display searchtext in UPPERCASE // searchBar.text = [searchText uppercaseString]; // searchBar.showsCancelButton = (searchText.length > 0); // [ContactSelection setNameOrEmailFilter:searchText]; // [tableController loadData]; } - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { // [searchBar setShowsCancelButton:FALSE animated:TRUE]; } - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { // [searchBar setShowsCancelButton:TRUE animated:TRUE]; } - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { // [searchBar resignFirstResponder]; } @end