2016-03-26 27 views
0

UITableViewController cihazımda bir UISearchController var. Kullanıcı aşağı kaydırılana kadar arama çubuğunun gizlenmesini istiyorum.UISearchController Arama Çubuğunu Gizle

//Hides the search bar until user manually scrolls up. 
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO]; 
CGRect newBounds = self.tableView.bounds; 
newBounds.origin.y = newBounds.origin.y + self.searchBar.bounds.size.height; 
self.tableView.bounds = newBounds; 

Maalesef yukarıdaki kod artık UISearchController çalışır: Eski UISearchDisplayController, benim viewDidLoad yönteminde aşağıdaki kodu vardı.

cevap

2

Sadece sorunu çözdünüz. Aşağıda Yerine self.searchBar ait

newBounds.origin.y = newBounds.origin.y + self.searchController.searchBar.bounds.size.height; 

, bu self.searchController.searchBar

olması gerekiyor
newBounds.origin.y = newBounds.origin.y + self.searchBar.bounds.size.height; 

olması gerektiği, yanlış
İlgili konular