简体   繁体   English

防止在执行[tableView reloadData]时显示TablewViewHeader

[英]Prevent TablewViewHeader to show when [tableView reloadData] is performed

does anyone know if there is a way to prevent my table view header to show (in this case a UISearchBar ) when a [tableView reloadData] is performed. 有谁知道当执行[tableView reloadData]时是否有一种方法可以防止我的表视图标头显示(在这种情况下为UISearchBar )。

I want to avoid this behaviour. 我想避免这种行为。 The only way to show the search bar is when the user scrolls down the table. 显示搜索栏的唯一方法是当用户向下滚动表格时。

Thanks 谢谢

After [tableView reloadData]; [tableView reloadData];

Setting content offset(y position) of tableView might help. 设置tableView的内容偏移(y位置)可能会有所帮助。

CGFloat nSearchBarHeight = 40;
CGPoint point = (CGPoint){0,nSearchBarHeight};
tableView.contentOffset = point;

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 调用[tableView reloadData]时,TableView无法重新加载 - TableView not reloading when calling [tableView reloadData] 当tableview在子视图ViewCon的子视图中时,如何reloadData - how to reloadData when tableview is in a subview of subview ViewCon 为tableView完成ReloadData时,应用程序崩溃 - App Crashes when ReloadData done for the tableView tableView reloadData时单元格中的UIImageView闪烁 - UIImageView in cell flicker when tableView reloadData 在屏幕上触摸时停止`-[tableView reloadData]` - Stop `-[tableView reloadData]` when touched on screen 调用tableView.reloadData()时,“致命错误”表明tableView已正确连接 - “fatal error” when calling tableView.reloadData(), the tableView is properly connected IOS / Xcode / Coredata:等效于[[self tableView] reloadData]; 什么时候没有tableview? - IOS/Xcode/Coredata: What is equivalent of [[self tableView] reloadData]; when there is no tableview? 当我从另一个类调用方法时,_tableView reloadData无法正常工作 - _tableView reloadData not working when i called method from another class 当执行[tableview reloadData]时,交互不起作用 - Interaction does not work when [tableview reloadData] is being executed UITableView tableView.reloadData()调用时没有更新,请问是什么原因导致的? - UITableView not updating when tableView.reloadData() is called, what is causing this problem?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM