我有一个 UITableViewCell,里面有一个 UISlider。我有一个表格视图的页脚文本,我想用 UISlider 的值进行更新。
但是,调用 [self.tableView reloadData]; 不适用于 UISlider,因为调用次数过多。我能够正确更新单元格(它也显示值),但我无法更新页脚文本。我努力了:
[self tableView:self.tableView titleForFooterInSection:0];
但它不起作用..
我有一个 UITableViewCell,里面有一个 UISlider。我有一个表格视图的页脚文本,我想用 UISlider 的值进行更新。
但是,调用 [self.tableView reloadData]; 不适用于 UISlider,因为调用次数过多。我能够正确更新单元格(它也显示值),但我无法更新页脚文本。我努力了:
[self tableView:self.tableView titleForFooterInSection:0];
但它不起作用..
将滑块连接到控制器中的操作方法:
[theSlider addTarget:self
action:@selector(adjustSliderValue:)
forControlEvents:UIControlEventValueChanged];
实现滑块动作方法:
- (void) adjustSliderValue: (UISlider *) slider
{
// Change controller's state here.
// The next line will trigger -tableView:titleForFooterInSection:
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex: mySectionIndex]
withRowAnimation:UITableViewRowAnimationNone];
}
这比重新加载整个表更有效。不幸的是,没有办法直接设置节页脚文本。