Would you guyz be so kind to help me with such question:
I have to fill the tableView with cells and I also have an array with objects to fill cells with.
The question is – how to skip creating a cell if the object doesn’t meet some conditions? I mean how to write something like:
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if(objectIsOk) {
//create cell
}
else {
//do nothing
}
return cell;
NOTE: I don’t have an access to that array of objects it gives me an object per indexPath.row dynamically
I’m unsure as to what you mean by “skip creating a cell”. Your table view data source is required to return a cell for each
cellForRowAtIndexPath:call, which will get called for each row in each section that you have said the table will contain.If you want to return a blank cell then why not just do something like this:
You could also return height of zero in the
heightForRowAtIndexPath:delegate method to make it appear that it’s not there, like so: