当我点击UISearchBar时,它下面会出现一个白框,但在随后调用UISearchBarDelegate
方法时,白框会消失。它仅在用户首次单击UISearchBar时显示。以下是我初始化UISearchDisplayController
和UISearchBar
的代码。如何删除此白框?
- (void)viewDidLoad {
[super viewDidLoad];
self.searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
self.searchBar.delegate = self;
_isSearching = NO;
self.searchCntrl = [[UISearchDisplayController alloc]initWithSearchBar:self.searchBar contentsController:self];
self.searchCntrl.delegate = self;
self.searchCntrl.searchResultsDataSource = self;
self.searchCntrl.searchResultsDelegate = self;
self.searchCntrl.displaysSearchBarInNavigationBar = YES;
}