tableView.scrollToRow对少量单元格的行为有所不同iOS版

时间:2017-11-24 04:45:10

标签: ios

我正在尝试给予tableView和searchBar(tableView.tableHeaderView = searchBar)与消息和邮件应用程序相同的行为,即将searchBar隐藏在父视图的顶部并滚动显示它。

问题是当tableView具有不同数量的单元格时,搜索栏会以不同方式显示/隐藏。如何每次隐藏搜索栏?

Not enough cells to fill the view

Just enough cells to fill the view

More than enough cells to fill the view

我正在使用的方法是tableView.scrollToRow(at:IndexPath(row:0,section:0),at:。top,animated:true)

0 个答案:

没有答案