Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UISearchController.searchBar 作为 UITableView.tableHeaderView 时,进入搜索状态,搜索结果列表顶部有一大片空白 #1473

Closed
MoLice opened this issue Jan 6, 2023 · 2 comments

Comments

@MoLice
Copy link
Collaborator

MoLice commented Jan 6, 2023

截图
image

如何重现

self.searchController = [[UISearchController alloc] initWithSearchResultsController:SearchResultController.new];
self.searchController.searchResultsUpdater = self;
self.searchController.searchBar.placeholder = @"点我搜索啊";
self.tableView.tableHeaderView = self.searchController.searchBar;

Demo:TestSearchController.zip

Lookin:QMUIDemo#1473.lookin.zip

预期的表现

搜索结果列表顶部和 searchBar 应该贴合在一起。

其他信息

  • 设备: All
  • iOS 版本: 仅测试 iOS 13+
  • Xcode 版本: Xcode 14
@MoLice
Copy link
Collaborator Author

MoLice commented Jan 9, 2023

建议这里不要让系统自动调整 scrollView.contentInset,因为在搜索结果列表 push 进入下一级界面时 navigationBar 会经历隐藏→显示的切换,这个切换过程,scrollView.contentInset 也会跟着跳变,导致列表跳动。所以干脆将 contentInsetAdjustmentBehavior 设置为 Never 来避免 bug 及跳动。

@MoLice
Copy link
Collaborator Author

MoLice commented Jul 24, 2023

已发布 4.7.0 修复该问题。

@MoLice MoLice closed this as completed Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant