@property (nonatomic, retain) IBOutlet UILabel* customLabel;
Автоматический подсчет ссылок (ARC) запрещает явный вызов retain
. Попробуйте удалить это.
Что касается ошибки, вы возвращаете UITableViewCell
, а не свою пользовательскую ячейку. Кроме того, вы никогда не выделяете свой ResultsCustomCell
.
- (ResultsCustomCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
ResultsCustomCell *cell = (ResultsCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[ResultsCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell.
cell.textLabel.text = @"Text";
return cell;
}
Кроме того, ваш подкласс UITableViewCell
не объявляет (очевидно обязательный) метод init
.
ResultsCustomCell.h:
#import <UIKit/UIKit.h>
@interface ResultsCustomCell : UITableViewCell
@property (strong, nonatomic) UILabel *myLabel;
@end
ResultsCustomCell.m:
#import "ResultsCustomCell.h"
@implementation ResultsCustomCell
@synthesize myLabel;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
@end
РЕДАКТИРОВАТЬ: Я видел, что вы используете раскадровку. Мое предложение может или не может быть полезным для вас. Я никогда не использовал раскадровку.