Hello friends.
I have a different problem.
I am creating my TableViewCells like:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell;
UILabel *label = nil;
NSString *cellIdentifier = [NSString stringWithFormat:@"Cell_%i", indexPath.row];
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
//cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier];
label = [[UILabel alloc] initWithFrame:CGRectZero];
[label setLineBreakMode:UILineBreakModeWordWrap];
[label setMinimumFontSize:FONT_SIZE];
[label setNumberOfLines:0];
[label setFont:[UIFont systemFontOfSize:FONT_SIZE]];
[label setTag:1];
[[cell contentView] addSubview:label];
}
return cell;
}
as you see, i have cells with identifiers like "Cell_0 , Cell_1, etc"
and in a function which is not a TableView Method, i want to use this cells by calling their identifiers. i do this like:
UITableViewCell *cell = [myTableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"Cell_%i", myCellID]];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:[NSString stringWithFormat:@"Cell_%i", myCellID]];
}
UILabel *label = (UILabel*)[cell viewWithTag:1];
cant i use like this?
i am trying to change the color of label in the cell i try to access, but i cant. cell is not nil, but label is always nil. what should i do?
how can i understand if its the cell i want or an empty cell?