Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS7: How to add a fixed Search Bar like Contacts on iOS7?

After I search a lot of questions and answers, no good result. So I have to ask it here:

I want to add a Search Bar below the navigation bar.

This search bar should be fixed. Just like contacts on iOS7 below.

iOS7 contacts Can any one help me to figure it out?

like image 911
Honghao Zhang Avatar asked Mar 02 '14 21:03

Honghao Zhang


1 Answers

You have a view controller. It has a main view. Inside that main view is a search bar (UISearchBar) and, below that, a table view (UITableView).

Your view controller is embedded in a navigation controller (UINavigationController).

UINavigationController

MyViewController (UINavigationController) - child of the navigation controller

UIView - main view of MyViewController

|--- UISearchBar (subview of UIView)
|
|--- UITableView (another subview of UIView)
like image 174
matt Avatar answered Nov 09 '22 20:11

matt