Я пытаюсь использовать свойство displaysSearchBarInNavigationBar
в классе iOS7 UISearchDisplayController
для отображения строки поиска внутри панели навигации.
Используя пример AdvancedTableSearch от Apple в качестве базы, я изменил код, чтобы отключить области (которые не разрешены в панели навигации ) и установите displaysSearchBarInNavigationBar
в true, например.
- (void)viewDidLoad
{
[super viewDidLoad];
// create a mutable array to contain products for the search results table
self.searchResults = [NSMutableArray arrayWithCapacity:[self.products count]];
self.searchDisplayController.displaysSearchBarInNavigationBar = YES;
}
К сожалению, результат, который я получаю, выглядит следующим образом:
Строка поиска отображается в середине экрана, а не в элементе navigation.txt.
Что я делаю неправильно?
PS: Я не уверен, связано ли это, но self.searchDisplayController.navigationItem
свойство nil
.