Xcode UITableView detailTextLabel不使用自定义单元格
我已经创建了一个自定义单元格,它当前显示的是图像和文本,而不是细节文本 即使使用“cell.detailTextLabel.text”,它仍然不会显示。有人知道怎么回事吗 我已尝试将UITableViewCellStyleSubtitle更改为UITableViewCellStyleDefault和其他 在过去的几个小时里,我搜索了这个网站和谷歌,尝试修复,但没有一个成功 任何帮助都将不胜感激Xcode UITableView detailTextLabel不使用自定义单元格,xcode,ios5,uitableview,custom-cell,detailtextlabel,Xcode,Ios5,Uitableview,Custom Cell,Detailtextlabel,我已经创建了一个自定义单元格,它当前显示的是图像和文本,而不是细节文本 即使使用“cell.detailTextLabel.text”,它仍然不会显示。有人知道怎么回事吗 我已尝试将UITableViewCellStyleSubtitle更改为UITableViewCellStyleDefault和其他 在过去的几个小时里,我搜索了这个网站和谷歌,尝试修复,但没有一个成功 任何帮助都将不胜感激 -(UITableViewCell *)tableView:(UITableView *)tableV
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"myCell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray *sortedCategories = [self.tweetSongs.allKeys sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
NSString *categoryName = [sortedCategories objectAtIndex:indexPath.section];
NSArray *currentCategory = [self.tweetSongs objectForKey:categoryName];
NSDictionary *currentArtist = [currentCategory objectAtIndex:indexPath.row];
NSDictionary *currentSong = [currentCategory objectAtIndex:indexPath.row];
cell.textLabel.text = [currentSong objectForKey:@"Song"];
cell.detailTextLabel.text = [currentArtist objectForKey:@"Artist"];
cell.textLabel.textColor = [UIColor whiteColor];
cell.imageView.image = [UIImage imageNamed:[currentArtist objectForKey:@"Artwork"]]
}
这里是单元格屏幕截图的链接(我不允许在没有10个代表的情况下附加图像):
像这样试试。它在我的Xcode中工作 尝试更改此行
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
我将改为使用样式默认值初始化。看看这是否有帮助。问题是自定义单元格的高度太小,我想无论如何,因为当我增加高度时,它起作用了 谢谢你的回复,我只是尝试了一下,但仍然没有创建detailTextLabel。文本标签集中在单元格的中间,看起来好像没有字幕的字幕-检查我截取的截图,谢谢,但遗憾的是它没有添加字幕。
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];