Мое приложение падает, когда я хочу установить текст метки, принадлежащей ячейке таблицы. Мой фрагмент кода выглядит следующим образом:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:simpleTableIdentifier];
[cell autorelease];
CGRect splitMethodLabelRect = CGRectMake(160, 6, 50, 30);
UILabel *splitMethodLabel = [[UILabel alloc] initWithFrame:splitMethodLabelRect];
splitMethodLabel.textAlignment = UITextAlignmentLeft;
splitMethodLabel.font = [UIFont systemFontOfSize:13];
splitMethodLabel.tag = kSplitMethodTag;
[cell.contentView addSubview: splitMethodLabel];
[splitMethodLabel release];
}
UILabel *splitMethodName = (UILabel *)[cell.contentView viewWithTag:kSplitMethodTag];
//app crashes at this point
splitMethodName.text = @"Test";
Кажется, проблема в том, что я задаю текст.
Stacktrace ниже:
2011-04-21 15:11:10.820 BillSplitter[3021:707] -[UITableViewCellContentView setText:]: unrecognized selector sent to instance 0x18a680
2011-04-21 15:11:10.829 BillSplitter[3021:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView setText:]: unrecognized selector sent to instance 0x18a680'
Любые советы по этому вопросу очень ценятся!
Zhen