Adding a UISearchBar to a UITableView

I have a UITableView and I put a UISearchbar on it. I want to make sure that if the user scrolls, I want the UISearchbar element to be fixed on top, plus I also want the first line of the UITableView to be fixed. Is there any sample code for this?

Until now, every sample that I found that the UISearchbar was not fixed at the top, if you scroll it, it will disappear. One way to eliminate the UISearchbar element could be if I placed the UIView under both elements (UITableView and UISearchbar) and put the two in a row between themselves (just the idea that I don't know if this actually works). However, I am not sure if this is a suitable way, and it also won’t fix that I want the first line to be fixed.

I'm a little new to this stuff, would be glad if someone could point me in the right direction, thanks.

+3
source share
1 answer

For a fixed search bar: just make it native to the View table.

For a fixed first row: perhaps make it the section heading and have only 1 section or make it a representation for sisters.

+3
source

Source: https://habr.com/ru/post/1726387/


All Articles