【问题标题】:Edit Mode in UITableViewUITableView 中的编辑模式
【发布时间】:2011-06-05 17:25:07
【问题描述】:

所以我已经实现了

- (BOOL)tableView:(UITableView *)tableView
canEditRowAtIndexPath:(NSIndexPath *)indexPath

- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath

但是我将如何触发某些东西以将 tableview 切换到编辑模式?就像您单击编辑时 iphone 中的消息一样,会出现删除图标。这可能听起来很基本,但我对此一无所知,而且有点紧急,任何线索将不胜感激,谢谢。

【问题讨论】:

    标签: iphone objective-c iphone-sdk-3.0 uitableview


    【解决方案1】:

    您还可以使用导航控制器并在其中加载表格视图。然后只需为左侧导航栏项分配一个编辑按钮,它就会为您切换编辑。

    // in the table viewDidLoad
    
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    

    【讨论】:

      【解决方案2】:
      [tableView setEditing:YES animated:YES];
      

      【讨论】:

      • 非常感谢! :) 多谢!!我很高兴能得到快速正确的回应。最美好的祝愿!
      猜你喜欢
      • 1970-01-01
      • 2014-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多