Why placeholder text jump upward little when first tap searchBar?
Why placeholder text jump upward little when first tap searchBar?
I put a searchBar in first cell in the UITableView (not in UITableView header!) :
firstCell.contentView.addSubview(searchController.searchBar)
and I canceled hide navigation bar when search happened :
searchController.hidesNavigationBarDuringPresentation = false
and full setup searchController code in below :
func setupSearchController(){
//custom Search Results Controller
let folderSearchVC = FolderSearchViewController()
searchController = UISearchController(searchResultsController: folderSearchVC)
//cancel hide NavigationBar
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchResultsUpdater = folderSearchVC
searchBar = searchController.searchBar
searchBar.placeholder = "搜索习惯组"
firstCell.contentView.addSubview(searchBar)
}
But when I first activate the searchBar,the placeholder text will jump upward a little,only for the first time (demo in below GIF):
You can see in the demo gif ,when I first tap searchBar,the placeholder text jump upward a little,and follow tap is all OK!
my Q is how to forbid placeholder text to jump upward ???
thanks ;)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.