Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的应用程序中,我有一个表格视图和一个搜索栏。我能告诉我最初隐藏表格视图并显示搜索栏的方法,而且当我点击搜索栏时,只会显示表格视图。请提供一些答案。
谢谢,克里斯蒂
每个视图都有一个hidden属性。每当你想隐藏表格时,就这样做[tableView setHidden:YES]。至于在单击 searchBar 时显示 tableView,请将其委托设置为 self(或您正在实现的任何类UISearchBarDelegate),并在方法中searchBarTextDidBeginEditing:执行 [tableView setHidden:NO]。希望能帮助到你。
hidden
[tableView setHidden:YES]
UISearchBarDelegate
searchBarTextDidBeginEditing: