Flaviu's Blog - Read'n'Code

Float Search Bar to Top of UITableView in iOS

Don’t you wish you could scroll in the image above and keep the search bar floating at the top?

Two steps:

Uno. Add the UIScrollViewDelegate protocol to your interface:

Dos. Implement the scrollViewDidScroll protocol method:

Done. So easy.

But I kind of also want the search text field to be larger (increase its height). How hard can that be?

Well, as it turns out, pretty hard. After spending 1+ hour researching posts like this one, I gave up. I guess it looks OK the way Steve Jobs designed it.

Welcome to iOS.

Comments

Fork Flaviu on GitHub