Created
October 11, 2012 16:00
-
-
Save kreeger/3873395 to your computer and use it in GitHub Desktop.
Removing "empty" cells from a section.
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
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
NSInteger count = [[[self.tableSettings objectAtIndex:section] objectForKey:@"rows"] count]; | |
NSInteger emptyCount = 0; | |
for (int i = 0; i < count; i++) { | |
NSIndexPath *iPath = [NSIndexPath indexPathForRow:i inSection:section]; | |
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:iPath]; | |
if (cell.textLabel.text == nil || [cell.textLabel.text isEqualToString:@""]) emptyCount++; | |
} | |
return (count - emptyCount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment