//隐藏所有键盘:
- (void)hideKeyBoard
{
for (UIWindow* window in [UIApplication sharedApplication].windows)
{
for (UIView* view in window.subviews)
{
[self dismissAllKeyBoardInView:view];
}
}
}
-(BOOL) dismissAllKeyBoardInView:(UIView *)view
{
if([view isFirstResponder])
{
[view resignFirstResponder];
return YES;
}
for(UIView *subView in view.subviews)
{
if([self dismissAllKeyBoardInView:subView])
{
return YES;
}
}
return NO;
}
我认为效率应该很低,慎用!!
时间: 2024-10-09 04:16:51