I created a subclass of UITableViewCell , and I called it DCCustomCell . This is the DCCustomCell.h file.
All addictions are correctly associated with elements in my iPhone.storyboard file. I also selected tableViewCell in iPhone.storyboard , and I set my cell id to "CustomCell" and the class is DCCustomCell .
This is the UITableViewController viewDidLoad method:
- (void)viewDidLoad { [super viewDidLoad]; self.tableView.delegate = self; self.tableView.dataSource = self; [self.tableView registerClass:[DCCustomCell class] forCellReuseIdentifier:@"CustomCell"];
and this is tableView: cellForRowAtIndexPath: method:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"CustomCell"; DCCustomCell *cell = (DCCustomCell *)[tableView dequeueReusableCellWithIdentifier:identifier]; NSLog(@"%@" ,cell); cell.imageView.image = [UIImage imageNamed:@"info_button.png"]; cell.title.text = @"Hello!"; cell.date.text = @"21/12/2013"; cell.price.text = @"β¬15.00"; return cell; }
The problem is that the View image is properly configured, but all the labels are blank. If I change the name of the imageView property, for example, eventImageView, the image will not be set. This is the result:

I canβt understand how I can solve this problem.
EDIT: if I remove
[self.tableView registerClass:[DCCustomCell class] forCellReuseIdentifier:@"CustomCell"];
from viewDidLoad everything seems to work. why?
ios uitableview subclass storyboard
Marco manzoni
source share