テーブル ビュー コントローラーとカスタム セルを作成しました。カスタム セルのラベル用のアウトレットを持つ新しい tableviewCell ファイルを作成しました。
tableviewController に tableviewcell クラスをインポートし、次のコードで配列からセルに値を代入しようとしました:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier ];
}
cell.name.text= [data objectAtIndex:indexPath.row];
cell.name -----------(tableviewcell クラスの uilabel である名前が表示されない、ヘルプにも存在しない!、理由がわかりません)
以下のコードは、ラベルにタグを付けることで機能します
// Configure the cell...
// UILabel *label = (UILabel *)[cell viewWithTag:111];
// label.text= [data objectAtIndex:indexPath.row];
私の質問は、タグ付けせずにコンセント部分を機能させる方法と、なぜ uilabel が tableviewCONtroller に表示されないのですか?
助けてください。助けていただければ幸いです。
前もって感謝します。