Clear NSMutableArray for a refresh

problem might be due to numberOfRowsInSection returning some count and your data source array is empty.

just call [array removeAllObjects] and in numberOfRowsInSection return [array count].

I hope it will resolve your issue. Best of Luck!!!


I delete cells from my table view in the following manner-

NSMutableArray* indexPathsToDelete = [[NSMutableArray alloc] init];
            for(unsigned int i = 0; i < [self.array count]; i++)
            {
                [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:0]];
            }

[self.tableView beginUpdates];
[self.array removeAllObjects];
[self.tableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:UITableViewRowAnimationLeft];
[self.tableView endUpdates];
[indexPathsToDelete release];