それちょうど非常に基本的なもの、私はのUITableViewCellは - TextLabel.textは常にNULLです
cell.textLabel.text = @"Notification";
cell.detailTextLabel.text = @"Dates";
を行うとき、私はこの方法では、
今セルスタイル「右の詳細」でcellForRowAtIndexPathをのUITableViewを使用しています
テキストは画面に表示されません。私は
NSLog(@"%@ -- %@",cell.textLabel.text, cell.detailTextLabel.text);
のようなセルのテキストをログに記録する場合は、コンソールに次の行を出力します。ここ
(null) -- (null)
は、いくつかの詳細は以下のとおりです。
Xcodeのバージョン:8.3.1
シミュレータ: iPad Pro(12.9インチ)iOS 10.3
ストーリーボードベースのテーブルビュー スタイルオプションから既に「正しい詳細」オプションが選択されています。 が既にリクエストで次の
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]
をテストし、ここでは "CellForRowAtIndexpath" のための完全なコードがある
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = nil;
if (tableView == self.tableviewBusinessSettings) {
NSString *identifier = @"BCell";
cell = [tableView dequeueReusableCellWithIdentifier:identifier];\
NSDictionary *dictSetting = [self.arrayBusinessSettings objectAtIndex:indexPath.row];
[cell.textLabel setText:[dictSetting objectForKey:@"key"]];
[cell.detailTextLabel setText:[dictSetting objectForKey:@"value"]];
}else if (tableView == self.tableviewNotifications) {
NSString *identifier = @"NCell";
cell = [tableView dequeueReusableCellWithIdentifier:identifier];
cell.textLabel.text = @"Notification";
cell.detailTextLabel.text = @"Dates";
}
NSLog(@"%@ -- %@",cell.textLabel.text, cell.detailTextLabel.text);
return cell;
}
迅速な助けが必要。
おかげ
'cell'はnullですか? 'cell.textLabel'はnullですか? 'cell.detailTextLabel'はnullですか? 'cellForRowAtIndexPath:'コード全体を表示できますか?セルをデキューしましたか? – Larme
あなたの問題を理解できるように**完全な** cellForRowAtIndexPath **メソッドを表示してください。ありがとう – gEeKyMiNd
どちらのセルもnullでもcell.textLabelでもないので、インデックスの行の完全なセルを表示させてください – CevianTech