2009-11-02 53 views
0

請問誰能幫我解決這個問題?刪除行後添加文字

我有一個名爲favorite的選項,每當我選擇我最喜歡的歌曲時,歌曲將被添加到最喜歡的選項裏面。所以我爲它製作了一張桌子,每個單元格會存儲我選擇的每首歌曲。我也可以刪除歌曲。但在我選擇任何歌曲之前,我希望它能顯示一些通知文本。或者當我完全刪除該收藏夾中的所有內容時,我希望顯示相同的文本,並且每次添加任何內容時都必須消失。任何人都可以給我一個想法如何做到這一點?

// DELETE FAVORITE 
-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
} 

- (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];  
    } 
} 

這是我的代碼,用於刪除該表內的行。

回答