eugene
eugene

Reputation: 41785

How to implement overlay-tableview for search?

Youtube search on iOS

enter image description here

I guess it's a tableview. How do I make occupy variable amount of screen space like the image?

I can start with the terms I need to search, or concepts I need to learn. throw me some hints please.

Upvotes: 1

Views: 157

Answers (2)

BigSzu
BigSzu

Reputation: 271

Just add it as subview and set its height to something like:

CGFloat tableViewHeight = searchResultsNr * cellHeight;

Also make sure that there is some max height for it, so all cells are visable for more results like:

CGFloat maxHeight = screenHeight - serchBarHeight - keyboardHeight;

And just change frame on reloading your data, it should work.

Upvotes: 1

Cyril
Cyril

Reputation: 1649

Think about it as a full screen table view that is also added as a subview of the main view but hidden when the search is not active.

For this effect, just use a black translucent background color for your table view, your cells must have the white background color.

Hope that helps.

Upvotes: 0

Related Questions