我在navigationBar中设置了searchBar。激活后,它会动画并出现取消按钮。我试图停止动画并阻止取消按钮出现。我的故事板是一个在navigationController中设置的tableviewController。
self.searchController = [[UISearchController alloc]initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = NO;
self.searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, self.searchController.searchBar.frame.size.width, 44.0);
self.navigationItem.titleView = self.searchController.searchBar;
[self.searchController.searchBar setShowsCancelButton:NO animated:NO];
答案 0 :(得分:0)
尝试[self.searchController.searchBar showsCancelButton:NO]
。