【发布时间】:2009-11-04 05:09:41
【问题描述】:
我有 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张桌子也一样) 如果有人可以帮助我解决我遇到的这个问题,我很感激。
【问题讨论】:
标签: iphone objective-c cocoa-touch uitableview