在UITableView中更新部分页脚标题而不重新加载 [英] Update section footer title in UITableView without reloading
问题描述
我希望能够以编程方式更新表格视图中部分的页脚标题,同时我通过键盘输入文本。当我单击一个单元格以使其详细的文本视图可编辑时,键盘出现,所以我想更新页脚标题而不从数据源重新加载。
I would like to be able to programmatically update the footer title of a section inside a table view, while I am typing text through a keyboard. The keyboard appears when I click on a cell to make its detailedText view editable, so I would like to update the footer title without reloading from the data source.
实际上,如果我这样做,键盘会消失,所以它不是一种很好的互动形式。我无法找到解决这个问题的好方法......有什么建议吗?
In fact, if I did this, the keyboard would disappear so it is not a good form of interaction. I've not been able to find a good solution to this problem... any suggestions?
谢谢
推荐答案
如果你有分组表,你可以使用:
If you have groupped table, you can use:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
yourLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 17)]; //I'm not sure about the frame...
yourLabel.font = [UIFont systemFontOfSize:16];
yourLabel.shadowColor = [UIColor whiteColor];
yourLabel.shadowOffset = CGSizeMake(0, 1);
yourLabel.textAlignment = UITextAlignmentCenter;
yourLabel.textColor = RGB(76, 86, 108);
yourLabel.backgroundColor = [UIColor clearColor];
yourLabel.opaque = NO;
return yourLabel;
}
声明 yourLabel
in你的 .h
文件。然后,你可以通过
Declare yourLabel
in your .h
file. Then, you can access it via
yourLabel.text = @"whatever you want";
请检查是否有效:)
这篇关于在UITableView中更新部分页脚标题而不重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!