How to skip a specific string when populating my UITableView
I am populating a tableview from data that is received from a server. The
data is a list of user activities within a given timeframe. One such
activity is "Login". I do not wish to populate my tableview with this
string but I'm not sure how to skip it when populating my tableview.
Here is how I populate the cell
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
@try{
NSManagedObject *object = [self.fetchedResultsController
objectAtIndexPath:indexPath];
NSString *action = [object valueForKey:@"theActionName"];
if ([action isEqual:@"Login"]) {
return cell;
}
return cell;
}@catch (NSException *ex) {
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
return cell;
}
}
As you can see I tried using return cell but as you probably know it gives
me a blank cell when the table is displayed. I'm sure there is a simple
line of code for this but I came up blank with the search terms I used.
Could someone please enlighten me! Thanks!
P.S. you may be thinking I am not putting anything in any of the cells but
I pulled out a bunch of code to keep this short.
No comments:
Post a Comment