在iOS 13中,更改hidesSearchBarWhenScrolling的行为。在iOS 12中,该解决方案有效:
func hideSearchBar(hide: Bool) {
UIView.animate(withDuration: 0.5) {
self.navigationItem.hidesSearchBarWhenScrolling = hide
}
}
我们只是在用户向上或向下滚动时调用它。但是它不适用于ios13。我找不到其他解决方案,但是像这样的功能在Instagram,Twitter等中完美运行。