0

Kind of strange issue here:

I've got a custom nib UITableViewCell with a bunch of labels and an imageview. I set the file owner to UITableViewDelegate/Datasource, I set the custom class in nib file, and I loaded it in to my VC like this:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{    
    static NSString *CellIdentifier = @"BuildCell";
    BuildCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        NSArray *topLevelObjects = [[NSBundle mainBundle]loadNibNamed:@"BuildCell" owner:self options:nil];
        cell = [topLevelObjects objectAtIndex:0];
    }
    ...
    return cell
}

What is odd is that whenever I set the cellIdentifier to an ID different from what it is in my storyboard, everything loads fine (But this is an issue since then I can't get the segue to work properly). When I set the cell identifiers to match, only some of the properties work correctly. How could this be??

here is the full implementation of the cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{    
    static NSString *CellIdentifier = @"BuildCell";
    BuildCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        NSArray *topLevelObjects = [[NSBundle mainBundle]loadNibNamed:@"BuildCell" owner:self options:nil];
        cell = [topLevelObjects objectAtIndex:0];
    }

    Build *build = [self.builds objectAtIndex:indexPath.row];

    //cell.school.text = build.school;
    cell.device.text = build.sdk;
    cell.buildType.text = build.config;
    cell.creator.text = [NSString stringWithFormat:@"By %@", build.creator];
    cell.time.text = build.dateCreated;

    switch (build.buildStatus) {
        case kSuccess:
            cell.imageView.image = [UIImage imageNamed:@"greensmall.png"];
            break;
        case kInProgress:
            cell.imageView.image = [UIImage imageNamed:@"yellowsmall.png"];
            break;
        default:
            cell.imageView.image = [UIImage imageNamed:@"redsmall.png"];
            break;
    }        

    return cell;        
}

The only piece that loads properly is the imageView. None of the labels show up. Any ideas?

Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90

0 Answers0