【问题标题】:Uneven section header size in static UITableView静态 UITableView 中的节标题大小不均匀
【发布时间】:2014-09-14 14:01:15
【问题描述】:

我创建了一个简单的静态 UITableView,它嵌入在 UINavigationController 中。我不明白为什么第一节标题的高度大于第一节之后的节标题的高度。我希望节标题的高度相同。

注意:如果可能的话,我想在故事板中做所有事情。

【问题讨论】:

  • 这不是第一节标题的高度。使用静态 UITableView 时,第一节上方有一个空格。
  • 谢谢@Rick。你知道去除多余空间的方法吗?

标签: ios uitableview static uinavigationcontroller


【解决方案1】:

我认为您不能仅在 Storyboard 中执行此操作。我能够让事情看起来像我想要的方式的唯一方法是实现类似的东西;

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{

if (section==0)
{
    return 25;
}
else
if (section==1)
{
    return 35;
} // etc etc

然后,在 Storyboard 中,调整 Table View Size、Section Height 值。

【讨论】:

  • 返回部分 == 0 ? 35 : 25;
猜你喜欢
  • 2018-11-28
  • 1970-01-01
  • 1970-01-01
  • 2012-09-06
  • 1970-01-01
  • 2017-06-19
  • 1970-01-01
  • 2021-11-21
  • 1970-01-01
相关资源
最近更新 更多