【问题标题】:Why heightForHeaderInSection doesn't work in iOS 4.3?为什么 heightForHeaderInSection 在 iOS 4.3 中不起作用?
【发布时间】:2012-04-06 20:38:43
【问题描述】:

为什么 heightForHeaderInSection 和 heightForFooterInSection 在 iOS 4.3 中不起作用而在 5.0 中起作用?

  -(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
  {
     if (section == 0) {
        return 10.0;
     }
     return (tableView.sectionHeaderHeight - 20);
  }

  -(CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section
  {
     if (section == ([self.optionsArray count] - 1)) {
        return 15.0;
     }
     return (tableView.sectionFooterHeight - 20);
  }

【问题讨论】:

    标签: iphone cocoa-touch ipad uitableview objective-c-2.0


    【解决方案1】:

    来自 Apple 文档

    在 iOS 5.0 之前,对于 tableView:viewForHeaderInSection: 返回 nil 视图的部分,表视图会自动将标题的高度调整为 0。在 iOS 5.0 及更高版本中,您必须在此方法中返回每个节标题的实际高度。

    【讨论】:

      猜你喜欢
      • 2011-12-08
      • 1970-01-01
      • 1970-01-01
      • 2018-01-09
      • 2012-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-08
      相关资源
      最近更新 更多