1.比较简单,在哪里有能用,不用找到第一响应者是谁;
UIWindow * keyWindow=[[UIApplicationsharedApplication] keyWindow];
[keyWindowendEditing:YES];
2.遍历找第一响应者,取消;
-(void)doResignFirstResponder:(UIView *)myView
{//循环遍历找到第一相应者取消
for (UIView * viin myView.subviews) {
if ([vi isFirstResponder]) {
[vi resignFirstResponder];
break;
}
else{
[selfdoResignFirstResponder:vi];
}
}
}
-(void)hiddenKeyBorad:(id)sedner
{//取消键盘的方法
UIWindow * keyWindow=[[UIApplicationsharedApplication] keyWindow];
[selfdoResignFirstResponder:keyWindow];
}