views:

50

answers:

1

Could anyone help me solve this problem please?

I have a option called favorite, each time I choose my favorite song, the song will be added into inside that favorite option. So I made a table for it, and each cell will store each song the i choose. I can remove the song as well. But before I choose any song, inside that table I want it to display some notice text. Or when I completely delete everything inside that favorite, I want the same text to appear and it must disappear each time there is anything added. Could anyone give me an idea how to do so?

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

Here is my code that used to delete the row inside that table.

A: 

I answered your question over here: http://stackoverflow.com/questions/1662008/insertion-and-deletion-in-the-table-of-objective-c/1662163#1662163

But I assumed you were using OS X, on the iPhone you do the same thing, but the method is:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
bmalicoat