Im使用帶有tableView的UIViewController。我已經設置了一個searchcontroller並將搜索欄嵌入到tableview標題中。當我搜索它時,會在桌面視圖和其上方的視圖之間留下狀態欄大小的差距。我意識到關於這個問題還有很多其他問題,但他們都沒有解決這個問題。在tableview標題中的UISearchController搜索欄留下狀態欄大小的差距
這裏是設置搜索欄的代碼:
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = YES;
self.searchController.searchBar.delegate = self;
self.searchController.searchBar.backgroundImage = [UIImage new];
self.searchController.searchBar.backgroundColor = kBlueNavBarColor;
self.searchController.searchBar.tintColor = [UIColor whiteColor];
self.tableView.tableHeaderView = self.searchController.searchBar;
self.definesPresentationContext = YES;
謝謝,這是行不通的。 –
當您調整導航欄的大小時,會發生什麼情況,灰色仍然稍微低一點? – Yan
我想通了,看到我的答案。謝謝。 –