我有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張桌子也一樣) 我很有趣,如果有人可以幫我解決這個問題,我一直在。