ฉันไม่สามารถเพิ่ม UISearch Controller บนแถบนำทาง iOS 9 ได้ .. มีหลายอย่างบนอินเทอร์เน็ต แต่ไม่มีเลยที่ทำงานเลย ..
รหัสคือ..
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
searchController.searchResultsUpdater = self;
searchController.delegate = self;
searchController.searchBar.delegate = self;
searchController.hidesNavigationBarDuringPresentation = NO;
searchController.dimsBackgroundDuringPresentation = YES;
self.navigationItem.titleView = searchController.searchBar;
self.definesPresentationContext = YES;
}
-(void)updateSearchResultsForSearchController:(UISearchController *)searchController{}