我有一個帶有標準UITableView的UIViewController和添加了Search委託的搜索欄。該視圖在導航欄中有一個分段控件,當用戶更改分段控件時,我想隱藏searchBar。隱藏UITableView searchBar留下一個空格
我使用的代碼是:
- (void)segChange {
if ([segmentedControl selectedSegmentIndex] == 0) {
[[[self searchDisplayController] searchBar] setHidden:YES];
// This does not work:
[[[self searchDisplayController] searchResultsTableView] setContentOffset:CGPointZero animated:NO];
}
else {
[[[self searchDisplayController] searchBar] setHidden:NO];
}
}
的代碼隱藏搜索欄很好,但它也使表格視圖頂部討厭的白色空間....如何得到任何想法擺脫它???
感謝
正是我在找的!謝謝......像魅力一樣工作! – 2015-10-22 14:38:18