【问题标题】:TableView not responsing to an "edit" button in UINavigationControllerTableView 没有响应 UINavigationController 中的“编辑”按钮
【发布时间】:2011-03-21 13:40:43
【问题描述】:

我的应用程序是一个购物清单,其中一个 UINavigationController 推送一个 UITableViewController。导航控制器有一个“编辑”按钮,用于处理删除和重新排列行的顺序。

到目前为止,一切都运行良好。但是我决定在应用程序中包含 iAd。我可以在 UITableViewController 中做到这一点,但 iAd 会随着 TableView 滚动。所以我跟着Ray Wenderlich's tutorial 了解了如何在 TableView 中包含 iAd,他的解决方案是 SubClass UIViewController 并将 TableView 嵌套在里面。

现在这种方法效果很好,除了一件事我无法真正理解。 tableView 不再响应编辑按钮。点击编辑绝对没有任何作用!有人可以解释为什么会发生这种情况以及解决方案是什么?


【问题讨论】:

    标签: iphone uiviewcontroller uinavigationcontroller uitableview


    【解决方案1】:

    我很确定您需要自己处理 setEditing 消息。您需要在视图控制器中覆盖 setEditing:animated:,使其看起来像这样。

    - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
        [super setEditing:editing animated:animated];
        [self.tableview setEditing:editing animated:animated];
    }
    

    如果我们能看到UITableViewController 的源代码,这个方法的实现可能看起来像这样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-23
      • 2011-05-22
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-24
      相关资源
      最近更新 更多