我想使搜索栏活动,并显示键盘时,客户选择搜索菜单上的标签栏。但是resignfirstresponder不工作。你还有其他建议吗?感谢您的批准。这在我的viewdidload方法中
[[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTextColor:[UIColor grayColor]];
[[UITextField appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setBackgroundColor:[UIColor whiteColor]];
_searchBarNew.placeholder = [MCLocalization stringForKey:@"courses"];
_searchBarNew.backgroundImage = [UIImage imageNamed:@"grey_background"];
_searchBarNew.delegate = self;发布于 2016-03-23 00:06:07
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(dismissKeyboard)];
[self.view addGestureRecognizer:tap];
Once your requirement is done , tap anywhere in the screen to resign the keyboard
-(void)dismissKeyboard {
[TxtFieldObj resignFirstResponder];
}https://stackoverflow.com/questions/36158518
复制相似问题