Ich habe einen UITableViewController mit zwei IBOutlet zu zwei verschiedenen UITableViewCells, die in IB gemacht wurden. Sie werden jedoch nicht in der TableView angezeigt. Wenn Sie den Fehler finden können, werde ich es wirklich zu schätzen wissen.UITableView Benutzerdefinierte Zellen werden nicht angezeigt
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *categoryIdentifier = @"Category";
static NSString *songDetailsCellIdentifier = @"sdci";
static NSString *socialCellIdentifier = @"sdcssi";
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
switch (indexPath.row) {
case 0:
//imageView = [[UIImage alloc] initWithData:imageData];
//songNameLabel.text = songName;
//artistNameLabel.text = artistName;
//albumNameLabel.text = albumName;
//numberInChartsLabel.text = [[NSString alloc] initWithFormat:@"%d", numberInCharts];
break;
case 1:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:categoryIdentifier] autorelease];
cell.textLabel.text = [[NSString alloc] initWithFormat:@"Category"];
cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@", category];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
break;
case 2:
cell.textLabel.text = [[NSString alloc] initWithFormat:@"Preview This Track"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
break;
case 3:
cell.textLabel.text = [[NSString alloc] initWithFormat:@"View This Song In iTunes"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
break;
case 4:
cell.textLabel.text = [[NSString alloc] initWithFormat:@"View Artist In iTunes"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
break;
case 5:
break;
}
// Configure the cell...
if (indexPath.row == 0) {
songDetailsCell = [[[UITableViewCell alloc] initWithFrame:songDetailsCell.frame reuseIdentifier:songDetailsCellIdentifier] autorelease];
return songDetailsCell;
}
if (indexPath.row == 5) {
socialCell = [[[UITableViewCell alloc] initWithFrame:socialCell.frame reuseIdentifier:socialCellIdentifier] autorelease];
return socialCell;
} else if (indexPath.row> = 1 & & indexPath.row < = 5) { return Zelle; } Rückkehr Null; }
Ich habe das versucht, die Zelle wird immer noch nicht angezeigt. – MKDev
versuchen Sie diesen Code, es funktioniert: http://pastie.org/1412313 – WrightsCS
stellt sich heraus, es war, weil ich nicht die Feder in der vorherigen Ansicht geladen wurde. – MKDev