Es ist nur sehr einfache Sache, ich bin mit UITableView mit Zell Stil "Right Detail"UITableViewCell mit dem rechten Detail - TextLabel.text ist immer NULL
nun in Verfahren cellForRowAtIndexPath wenn ich
cell.textLabel.text = @"Notification";
cell.detailTextLabel.text = @"Dates";
tun
Es dauert nie der Text wird weder auf dem Bildschirm angezeigt. Wenn ich die Zelle Text log wie
NSLog(@"%@ -- %@",cell.textLabel.text, cell.detailTextLabel.text);
Er druckt die folgende Zeile in der Konsole
(null) -- (null)
Hier sind einige weitere Details:
Xcode Version: 8.3.1
Simulator: iPad Pro (12.9 Zoll) iOS 10.3
Storyboard basierte Tabellenansicht Bereits ausgewählte "Right Detail" -Option von Style-Option. bereits folgende
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]
Auf den Anfragen getestet, hier ist der vollständige Code für "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;
}
schnelle Hilfe benötigen.
Dank
'Zelle' ist null? 'cell.textLabel' ist null? 'cell.detailTextLabel' ist null? Könnten Sie Ihren ganzen 'cellForRowAtIndexPath:' Code zeigen? Haben Sie die Zelle richtig herausgenommen? – Larme
Bitte zeigen Sie Ihre vollständige ** cellForRowAtIndexPath ** Methode an, damit wir Ihr Problem verstehen können. Danke – gEeKyMiNd
Weder Zelle ist Null noch das cell.textLabel, lassen Sie mich die komplette Zelle für Zeile bei Index – CevianTech