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

懵懂的女人 提交于 2019-12-19 23:22:39

问题


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.

Can any one help me to figure it out?

回答1:


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)


来源:https://stackoverflow.com/questions/22133973/ios7-how-to-add-a-fixed-search-bar-like-contacts-on-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!