【问题标题】:UITableView tableFooterView off screen for iOS6?iOS6的UITableView tableFooterView关闭屏幕?
【发布时间】:2014-01-30 07:25:41
【问题描述】:

我有一个包含 UITableView 的视图。在视图确实加载时,我将表的 tableFooterView 设置为我手动创建的视图(包含按钮的 UIView)。当视图出现时,我调整 tableFooterView 的框架:

CGRect tableFrame = self.myTableView.frame;
CGRect originalFrame = self.tableFooter.frame;
CGSize imageSize = CGSizeMake(40.0f, 40.0f);
CGRect footerFrame = CGRectMake(originalFrame.origin.x, originalFrame.origin.y, tableFrame.size.width, imageSize.height);
self.tableFooter.frame = footerFrame;
CGRect nextFrame = CGRectMake((footerFrame.size.width - imageSize.width) / 2.0f, 0.0f, imageSize.width, imageSize.height);
self.tableFooterButton.frame = nextFrame;

在 iOS7 上,这是我想要的方式——当我滚动到表格底部时,我会看到我的页脚视图。在 iOS6 上,当我滚动到表格底部时,页脚视图仍然在屏幕外(我可以拉动滚动视图并看到它,但当我释放时它会重置屏幕外)。

我应该做些什么不同的事情?

【问题讨论】:

  • 在更改表格页脚的框架后试一试。 self.myTableView.tableFooterView = nil; self.myTableView.tableFootView = self.tableFooter.
  • @KudoCC 这行得通。谢谢!愿意将其添加为答案吗?

标签: ios cocoa-touch uitableview


【解决方案1】:

改变表格页脚的框架后,试试这个:

self.myTableView.tableFooterView = nil ;
self.myTableView.tableFooterView = self.tableFooter ;

【讨论】:

  • @AnkitAggarwal 如果我们改变 tableFooter 的框架,tableView 可能没有意识到这一点,所以它的 contentSize 不会正确改变。代码所做的是重置 tableView 的 tableFooterView,因此 UITableView 会相应地安排其内容。
  • 我不需要使用第一行(设置为零)。
猜你喜欢
  • 2013-10-24
  • 1970-01-01
  • 1970-01-01
  • 2012-04-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多