【问题标题】:tableHeaderView' height is changed automatically after pushing a new viewcontrolller and come backtableHeaderView'推新视图控制器后自动更改高度并返回
【发布时间】:2016-06-20 07:12:32
【问题描述】:

标题视图设置为tableView,标题视图是使用自动布局的 xib 文件。当点击一个tableView单元格并按下另一个tableViewController,然后点击返回按钮弹出tableViewController。但是headerView的高度从98变为34并且headerView和第一个单元格之间有一个间隙。这真的很奇怪。是有人知道如何解决这个问题吗?非常感谢!
pic with the right headerview height

pic with problem

【问题讨论】:

  • 你可以显示你的问题的截图
  • 给我看看你的 heightForRowAtIndexPath 方法 .. ?
  • @NiravDoctorwala 嗨,我已经上传了两个图片链接,请检查。谢谢!
  • @BalajiRamakrishnan Hi -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return [_messageTableViewCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height+1; }

标签: ios uitableview uitableviewsectionheader


【解决方案1】:

只要改变你的视图就会出现这样的

- (void)viewWillAppear:(BOOL)animated {
     self.navigationController.navigationBar.translucent = NO;
}

希望这会对你有所帮助。

【讨论】:

  • 哇!!!!!非常感谢!它确实有效。我使用第二行。再次感谢你。这很有帮助。
【解决方案2】:

或添加编程以禁用插入

   self.automaticallyAdjustsScrollViewInsets = false

或者如果您使用的是导航控制器

self.navigationController.automaticallyAdjustsScrollViewInsets = false

【讨论】:

  • 谢谢!我试过了,但是不行,我上传了两张截图。
  • 我也遇到过类似的tableview问题。但我已经通过取消勾选这个布尔值来解决。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-22
  • 1970-01-01
  • 1970-01-01
  • 2021-08-13
  • 2013-06-22
  • 1970-01-01
相关资源
最近更新 更多