私はインターフェイスビルダーUITableView
でカスタムを入力しているものを持っています。UITableViewCell
これらのカスタムtableviewcellsプロパティへのアクセスに問題があり、助けを期待しています。
Interface Builderでは、カスタムtableviewcellclass
を現在のViewコントローラーに設定しています(これにより、すべてのラベルオブジェクトをInterface Builderで正しいラベルに割り当てることができます)。したがって、InterfaceBuilderでラベルIBOutlet
を正しいラベルに設定しました。 NSStringを配列オブジェクト変数(NSStringタイプ)からUIlabelのテキストに渡そうとするとエラーが発生します。
Property 'cellDescription' not found on object of type 'UITableViewCell *'
以下は、カスタムtableviewcellを使用してテーブルビューを設定し、セルのUILabelに正しいテキストを入力するために使用したコードです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (indexPath.section == 0) {
// Set cell height
[self tableView:tableView heightForRowAtIndexPath:indexPath];
// Configure the cell using custom cell
[[NSBundle mainBundle] loadNibNamed:@"AutomotiveSearchCell" owner:self options:nil];
cell = autoSearchCell;
//call dataArrayOfObject that has all of the values you have to apply to the custom tableviewcell
SearchResultItem* myObj = (SearchResultItem*)[dataArrayOfObjects objectAtIndex:indexPath.row];
cell.cellDescription.text = myObj.seriesDescription; // This is where I am receiving the error
NSLog(@"%@", myObj.seriesDescription); // This logs the correct value
//Disclosure Indicator
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}