1

我有一个简单但自定义的部分标题,其中我在标签中显示动态内容。但是,当我弹出一个 VC 并在活动 VC 中运行 viewWillAppear 中的 [self.quickDialogTableView reloadData] 时,数据没有更新为正确的“self.sectionHeaderTitle。知道我做错了什么吗?

(void)sectionHeaderWillAppearForSection:(QSection *)section atIndex:(NSInteger)indexPath {
  if (indexPath == 0) {
  UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 5, 320, 110)];
  header.backgroundColor = [UIColor clearColor];

  UIView *header_background = [[UIView alloc] initWithFrame:CGRectMake(25, 10, 270, 100)];
  header_background.backgroundColor = [UIColor whiteColor];

  UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 255, 25)];
  title.text = @"A sample static title";

  UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(55, 40, 200, 40)];
  label.text = self.sectionHeaderTitle;

  [header addSubview:header_background];
  [header_background addSubview:title];
  [header_background addSubview:label];
  [section setHeaderView:header];
}
4

1 回答 1

0

尝试重新加载该部分,如下所示:

 [self.quickDialogTableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:UITableViewRowAnimationBottom];
于 2014-03-19T15:31:27.140 回答