custom tableViewCell labels not showing

I'm trying to implement a custom view cell on UITableViewController.

@interface PPCustomCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *tableViewTitle;
@property (weak, nonatomic) IBOutlet UILabel *tableViewSubtitle;
@end

PPCustomCell *cell = (PPCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell.accessoryView == nil) {
        UIImage *buttonUpImage = [UIImage imageNamed:@"button4.png"];
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setBackgroundImage:buttonUpImage
                          forState:UIControlStateNormal];
        [button setTitle:@"Unpaid" forState:UIControlStateNormal];
        [button sizeToFit];
        [button addTarget:self
                   action:@selector(tappedButton:)
         forControlEvents:UIControlEventTouchUpInside];
        cell.accessoryView = button;
    }
    cell.accessoryView.tag = indexPath.row;

    cell.tableViewTitle.text = [[remindersArray objectAtIndex:indexPath.row]reminderName];
    cell.tableViewSubtitle.text =[[remindersArray objectAtIndex:indexPath.row]reminderDueDate];

but getting this error 'NSInvalidArgumentException', reason: '-[UITableViewCell tableViewTitle]: unrecognized selector sent to instance

Please help.

UPDATE - I was using this, removed this line it worked. [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier];

Thanks everyone.

You're not allocating any cells!

Before yourif (cell.accessoryView == nil)call, you should include the following:

if (cell == nil) {
    cell = [[PPCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:etc...];
}
Tags: ios, uitableview
What Others Are Reading