【问题标题】:UITableViewCell - Changing All Cells to BackgroundViewUITableViewCell - 将所有单元格更改为 BackgroundView
【发布时间】:2013-05-03 23:31:05
【问题描述】:

我想向我的 TableViewController 添加一个 UIButton,它将 UITable 中的所有单元格从 contentView 更改为 backgroundView。

它具有与设置 self.myTableView.editing = YES 相同的功能,以显示所有单元格的 editingAccessoryView。

这可能吗?如果是这样,如何做到这一点?感谢您的回复!

【问题讨论】:

    标签: iphone ios objective-c xcode ipad


    【解决方案1】:

    按钮切换一个标志(例如,如果当前为 NO,则将 BOOL 属性设置为 YES)并调用 [self.myTableView reloadData]

    这会导致对所有可见行再次调用 cellForRowAtIndexPath:cellForRowAtIndexPath: 检查该标志(相同的 BOOL 属性)以决定如何处理背景视图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多