This code:
if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; }
will never be executed because dequeueReusableCellWithIdentifier: forIndexPath: guaranteed to dequeueReusableCellWithIdentifier: forIndexPath: new cell.
Unfortunately, registerClass:forCellReuseIdentifier: does not allow you to specify a UITableViewCellStyle .
Change dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath to just dequeueReusableCellWithIdentifier:CellIdentifier . This method does not guarantee that the cell will be returned. * When this is not the case, your code will then create a new cell with the style you want.
* - (This will be if you use the storyboard as rdelmar points out, but it is not).
Aaron brager
source share