我有3张称为收音机,歌曲和艺术家的表格。 现在,我想在表格中没有任何内容时为每个表格显示不同的文本。但是我希望在桌子内有东西时删除文字。我可以通过添加标签来显示文本。如何隐藏和显示表格中的标签?
if ([mainDataCenter.favoriteArtistArray count] == 0)
{
[label setTextColor:[UIColor whiteColor]];
[label setText:@"AUCUN FAVORI DE FICHE ARTISTE"];
}
else
{
[label setHidden:YES];
}
但文字是隐藏在一个表后(意思是有一些仅添加到特定的表),但在其他表中的其他文本也消失了。
- (void)tableView:(UITableView*)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath*)indexPath
{
// If row is deleted, remove it from the list.
if (UITableViewCellEditingStyleDelete == editingStyle)
{
WebRadio *aRadio = [mainDataCenter.favoriteWebRadioArray objectAtIndex:indexPath.row];
[mainDataCenter removeWebRadioFromFavorite:aRadio];
// Animate the deletion from the table.
[tv deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
这是我删除webradio表的东西的代码。 (其他3张桌子也一样) 我很有趣,如果有人可以帮我解决这个问题,我一直在。