pnizzle
pnizzle

Reputation: 6431

UITableViewCell won't change from Default style to Subtitle, despite all required settings/precedures

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?

Upvotes: 0

Views: 152

Answers (1)

Don
Don

Reputation: 529

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

Upvotes: 1

Related Questions