Suppose I have eight cells in mine UITableView, but I want to display only those cells that meet a specific condition. I went through this and implemented mine numberOfRowsInSectionas:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
int i = 0;
for (A2OActivityCounter *ac in activityCounters) {
if(ac.startDate != nil) {
i++;
}
}
if (i == 0) {
return 1;
}
return i;
}
This way, it will return exactly the number of cells that match the criteria, and the one time I want in my table view. I want to know how to implement this in my table view. For example, there are five out of eight cells that match the criteria, so the number of rows returned will be five. But I want these five cells to be displayed, and there should not be an empty cell between these cells. Therefore, if the cells are similar to:
A - satisfies the condition
B - satisfies the condition
C - **does not** satisfies the condition
D - satisfies the condition
E - **does not** satisfies the condition
F - satisfies the condition
G - **does not** satisfies the condition
H - satisfies the condition
, A, B, D, F H , . if (activityCounter.startDate != nil) cellForRowAtIndexPath, , , true, , (UITableViewCell *), ; t nil.
- , !