Interface Builder でカスタム セルを作成し、そのカスタム UITableViewCell クラスを作成しましたが、ロードしても変更は加えられません。カスタムクラスに次のコードがあります。
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
// Initialization code
//Get the wedding date and display it
myLabel.text = @"Hello";
}
return self;
}
myLabel はヘッダーで宣言され、プロパティがあり、Interface builder でリンクされていますが、アプリを実行してテーブルを表示すると、「Hello」テキストが表示されません。何か案は?
ありがとう。
編集:
私は nib ファイルを使用していません。ストーリーボード内の UITableViewController にあります。さらに、以下の cellForRowAtIndexPath コードは次のとおりです。必要なセル識別子を配列に入力し、その配列を作成するだけです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier;
for (int cell = 0; cell <= [tableCellsArray count]; cell++)
{
if ([indexPath row] == cell)
{
CellIdentifier = [tableCellsArray objectAtIndex:cell];
}
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
return cell;
}