Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I see correctly, you have empty cell in second example. You need to add subviews to your cell content in interface builder and connect it as outlets with your EvenCell class. For example: Add Label to your custom cell in interface builder, than make an outlet in EvenCell class for that label, you can name outlet for ex. titleLabel and than in your tableview:cellForRowAtIndexPath set your label text property by cell.titleLabel.text = [allKeys objectAtIndex:indexPath.row]</p> <p>I've just spotted that I missed part about adding new views to cell content in initWithStyle method. So I've just created example code in xCode and it worked for me even if cell subviews are added programatically in EvenCell initWithStyle method. This is example:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface EvenCell : UITableViewCell @property (nonatomic, strong) UILabel *textLabel; @end #import "EvenCell.h" @implementation EvenCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.textLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 50, 20)]; [self.contentView addSubview:self.textLabel]; } return self;} - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end </code></pre> <p>than In your tableView:cellForRowAtIndexPath: method</p> <pre><code> -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellId = @"MyCell"; EvenCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath]; if(cell == nil) { cell = [[testCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; } cell.textLabel.text = @"Example title"; return cell; } </code></pre> <p>And in interface builder set dynamic prototypes cells for UITableView, set cell class to EvenCell and set cell identifier to MyCell and it has to work. I've just check it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload