Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Searching a UITableView not a UITableViewController with UISearchController and OBJECTIVE C


Explanation: I cant find any tutorials telling me how to search a UITableView with the new UISearchController that is compatible for iOS 8 and uses Objective-C. I have an NSMutableArray defined called 'users' which has all the users from my Parse.com query and I have a small table view in my View Controller called 'usersTable' the methods for my usersTable are as follows:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"userCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    PFObject *tempObject = [users objectAtIndex:indexPath.row];

    cell.text= [tempObject objectForKey:@"username"];

    return cell;

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSLog(@"users:%lu",[users count]);
    return [users count];

Body 1: All I want to do is filter out the data that the user typed in the search bar using UISearchController NSMutableArray called users and then display it onto 'usersTable.' It'd be very helpful if you guys could give an example to understand.

Conclusion: Could somebody please, please help me as I have no idea on how to go about this as there are no explanations for the UISearchController at this point in time with Objective-C. I'd appreciate any help.

Thanks for your help,