Skip to content

Instantly share code, notes, and snippets.

@batosai
Created April 8, 2013 22:19
Show Gist options
  • Save batosai/5341048 to your computer and use it in GitHub Desktop.
Save batosai/5341048 to your computer and use it in GitHub Desktop.
Category for check if keyboard is open.
#import <UIKit/UIKit.h>
@interface UIWindow (KeyBoard)
+ (BOOL)isKeyBoardInDisplay;
@end
#import "UIWindow+KeyBoard.h"
@implementation UIWindow (KeyBoard)
+ (BOOL)isKeyBoardInDisplay {
BOOL isExists = NO;
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) {
if ([[keyboardWindow description] hasPrefix:@"<UITextEffectsWindow"] == YES) {
isExists = YES;
}
}
return isExists;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment