0

In my storyboard I have a UITableViewController with Dynamic Prototypes content setting. I have one prototype cell in there with the Identifier 'SearchTableCell'.

enter image description here

In my TableviewController I have the following quick code to test the connection to the storyboard prototype cell:

static NSString *searchTableCellIdentifier = @"SearchTableCell";
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerClass: 
        [UITableViewCell class] 
            forCellReuseIdentifier: searchTableCellIdentifier];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:searchTableCellIdentifier forIndexPath:indexPath];
    //I know, check if cell is nil and configure if so. Will do!
    cell.textLabel.text = @"Hi you!";
    cell.detailTextLabel.text = @"How are you today";
    return cell;
}

The cells coming up only have the textLabel text showing only. The subtitle is not showing. Am I missing something?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
pnizzle
  • 6,243
  • 4
  • 52
  • 81
  • Possible duplicate of [How do you load a prototype cell from a storyboard?](https://stackoverflow.com/questions/22257105/how-do-you-load-a-prototype-cell-from-a-storyboard) – dengApro Oct 09 '19 at 04:06
  • @dengApro nope, not a duplicate, I know how to load the prototype cell; there is nothing on that page that's different to what I have. My issue is that I have implemented all that is needed (event went back to basics) but still it wont change ;( – pnizzle Oct 09 '19 at 04:11
  • I have a feeling its a bug in the latest iOS 13 SDK, or the latest Xcode. – pnizzle Oct 09 '19 at 04:11
  • 2
    Try removing registerClass. – Don Oct 09 '19 at 04:14
  • @Don well I'll be a son of a goon. Removing Register class did it. Can you post as answer and I'll accept. – pnizzle Oct 09 '19 at 04:16

1 Answers1

1

Since you defined the prototype cell in the storyboard, you shouldn't call registerClass. Remove that call and it should work as expected.

Don
  • 479
  • 1
  • 4
  • 7