The UISearchBar behaves different in iOS 11 then in iOS 10 and below.
I handled to "fix" the size somehow with this code:
if #available(iOS 11.0, *) {
searchBar.heightAnchor.constraint(equalToConstant: 44).isActive = true
}
But I can't fix the animation. Any ideas, apart from just animating the search bar manually on push?
UIView.animate(withDuration: 0.3, animations: { [weak self] in
guard let strongSelf = self else { return }
strongSelf.searchBar.alpha = 0.0
})
See a video of the broken animation effect here.
Just wrap it with a UIView, and the animation comes back.
Look answer in UIPercentDrivenInteractiveTransition. It's using for update UIViews during UINavigationController transition in persentage value.
Other words, depends on how much UINavigationController already opened next view controller or move backwards views will have different appearance.
This value will help you update your search bar (alpha, width, etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With