首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在删除的行后添加文本

在删除的行后添加文本
EN

Stack Overflow用户
提问于 2009-11-02 17:40:10
回答 1查看 81关注 0票数 0

我有一个名为favorite的选项,每次我选择我最喜欢的歌曲时,这首歌都会被添加到那个最喜欢的选项中。所以我为它做了一个表格,每个单元格都会存储我选择的每首歌。我也可以删除这首歌。但在我选择任何歌曲之前,我想让它在表格中显示一些通知文本。或者,当我完全删除收藏夹中的所有内容时,我希望出现相同的文本,并且每次添加任何内容时,它都必须消失。有人能告诉我怎么做吗?

代码语言:javascript
复制
// 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];       
  }
}

下面是我的代码,用于删除该表中的行。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-11-03 00:21:07

我在这里回答了你的问题:insertion and deletion in the table of objective C

但我假设你使用的是OS,在iPhone上你会做同样的事情,但方法是:

代码语言:javascript
复制
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1660264

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档