利用下面的代码,当UITextField 输入框中焦点停留时,立刻跳转到搜索页面中,进行搜索处理。
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (textField == _searchTextField)
{
SearchViewController *_followSearchViewController = [[SearchViewController alloc]init];
[self.navigationController pushViewController:_followSearchViewController animated:YES];
}
return YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self resignTextResponder];
}