【发布时间】:2011-05-08 10:18:38
【问题描述】:
我已经用委托在 nib 文件中创建了一个自定义单元格。
我已经为自定义单元格定义了一个 .h 和 .m:
@interface InscriptionCustomCell : UITableViewCell {
IBOutlet UILabel *titreCell;
IBOutlet UITextField *contenuCell;
}
@property(nonatomic,retain) UILabel *titreCell; @property(nonatomic,retain) UITextField *contenuCell;
@结束
当我尝试将它与我的 tableView 一起使用时:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"InscriptionCustomCell";
InscriptionCustomCell *cell = (InscriptionCustomCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
//[cell.textLabel setText:@"Cell"];
// Configure the cell...
if(indexPath.section ==0)
{
[cell.titreCell setText:[model.listModuleInfoPerso objectAtIndex:indexPath.row]];
[cell.contenuCell setPlaceholder:[model.listModuleInfoPerso objectAtIndex:indexPath.row]];
}else {
[cell.titreCell setText:[model.listModuleInfoSupp objectAtIndex:indexPath.row]];
[cell.contenuCell setPlaceholder:[model.listModuleInfoSupp objectAtIndex:indexPath.row]];
}
return cell;
}
我有一个错误:
reason: '-[UITableViewCell titreCell]: unrecognized selector sent to instance 0x4b5f430'
为什么?我的自定义单元格是自己的声明!
【问题讨论】: