mar*_*wer 7 iphone uitableview ios
我希望能够以编程方式更新表视图中部分的页脚标题,同时我通过键盘输入文本.当我单击一个单元格以使其详细的文本视图可编辑时,键盘出现,所以我想更新页脚标题而不从数据源重新加载.
事实上,如果我这样做,键盘就会消失,所以它不是一种很好的互动形式.我无法找到解决这个问题的好方法......有什么建议吗?
谢谢
小智 9
我知道我迟到了这个帖子,但我发现你可以这样做:
[self.tableView beginUpdates];
[self.tableView footerViewForSection:section].textLabel.text = @"Whatever";
[[self.tableView footerViewForSection:section].textLabel sizeToFit];
[self.tableView endUpdates];
Run Code Online (Sandbox Code Playgroud)
如果您有分组表,则可以使用:
- (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;
}
Run Code Online (Sandbox Code Playgroud)
yourLabel在您的.h文件中声明.然后,您可以通过它访问它
yourLabel.text = @"whatever you want";
Run Code Online (Sandbox Code Playgroud)
请检查是否有效:)
| 归档时间: |
|
| 查看次数: |
7047 次 |
| 最近记录: |