I have a UIViewController with a UITableView and a UISearchBar inside. As soon as the searchbar becomes first responder, there's a small gap between the searchbar and the tableview.


There's no gap when the UISearchBar is a subview of the UIViewController view instead of being a subview of the UITableView.


Obviously, one issue with that approach is that the searchbar stick to the top and doesn't scroll along with other cells, which is not desired.
Any ideas?
Edit:
Two first images correspond to the UISearchBar being a child of the UITableView, where the gap is occurring.
Last two images correspond to the UISearchBar being a child of the UIViewController view, in which case there's no gap.
The gap is occurring when setting UINavigationBar translucent property to NO. Setting it to YES resolve the issue. Animation is smooth again and there's no gap between UISearchBar and UITableView. I can't explain why, and it appears to be a bug on Apple side as it is easy to reproduce by creating a sample project.
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