I am looking for an alternative method for cellForRowAtIndexPath. What I am trying to do is in my private method, I am checking if the text on the exiting cell is present into an array, if it is then select the cell else remain it deselected. I learnt that cellForRowAtIndexPath works only on visible cells and returns nil if the cell is invisible. Below is my present code:
- (void)selectCells:(NSArray *)array
{
for (int row = 0; row < [self.tableView numberOfRowsInSection:1]; row ++)
{
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row 1];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
if ([array containsObject:cell.textLabel.text] && !cell.isSelected)
{
[self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
}
}
What else can I use to achieve this?