0

ラベル付きのプロトタイプセルがあります

@property (nonatomic, strong) IBOutlet UILabel *itemName; 

クラス ECOMAdmPanelViewCell で宣言され、そのクラスは Identity インスペクターのセルに設定されます。アウトレット itemName - ラベルが作成されます。

この機能では

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"admPanelCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    if (cell == nil)
        cell = [[ECOMAdmPanelViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    cell.itemName.text = [items objectAtIndex:indexPath.row];

    // Configure the cell...

    return cell;
}

タイプ「UITableViewCell」のオブジェクトに「プロパティ「itemName」が見つかりません」というエラー メッセージが表示されます。誰が何が悪いのか教えてもらえますか?

4

3 に答える 3

1

この行を変更してください

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

これとともに

 ECOMAdmPanelViewCell *cell = (ECOMAdmPanelViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
于 2013-03-29T07:42:30.967 に答える
1

またはこれを使用します:

(ECOMAdmPanelViewCell *)cell.itemName
于 2013-03-29T07:40:58.530 に答える
1

これを試して

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"admPanelCell";
    ECOMAdmPanelViewCell *cell = (ECOMAdmPanelViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    if (cell == nil)
        cell = [[ECOMAdmPanelViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    cell.itemName.text = [items objectAtIndex:indexPath.row];

    // Configure the cell...

    return cell;
}
于 2013-03-29T07:37:05.693 に答える