我可以在UISearchbar
方法调用上显示viewWillAppear
的键盘,而无需触及UISearchbar
吗?
答案 0 :(得分:18)
[mySearchBar becomeFirstResponder];
答案 1 :(得分:1)
工作解决方案: -
在使用firstFirstResponder之前不要使用[self.searchController setActive:YES]。
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
//[self.searchController setActive:YES];
[self.searchController.searchBar becomeFirstResponder];
});
});
}