UITableViewCell get nil
- by MTA
I create a UITableView with custom UITableViewCell,this is how i create the cell in cellForRowAtIndexPath:
static NSString *CellIdentifier = @"SongsCell";
SongsCell *cell = (SongsCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
UIViewController *vc = [[[UIViewController alloc] initWithNibName:@"SongsCell" bundle:nil] autorelease];
cell = (SongsCell *) vc.view;
}
now i want to get all cells in the table info (parameter from cell) when a button pressed:
for (int i = 0; i < [songTable numberOfRowsInSection:0]; i++)
{
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
UITableViewCell *cell = [songTable cellForRowAtIndexPath:indexPath];
}
Now i have a problem that this loop give me for cell a nil for all the cell that currently not seen in the table.