Created
August 28, 2014 10:04
-
-
Save onmyway133/197058d3fdc747626239 to your computer and use it in GitHub Desktop.
visibleKeyboardHeight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SVProgressHUD | |
- (CGFloat)visibleKeyboardHeight { | |
UIWindow *keyboardWindow = nil; | |
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) { | |
if(![[testWindow class] isEqual:[UIWindow class]]) { | |
keyboardWindow = testWindow; | |
break; | |
} | |
} | |
for (__strong UIView *possibleKeyboard in [keyboardWindow subviews]) { | |
if([possibleKeyboard isKindOfClass:NSClassFromString(@"UIPeripheralHostView")] || [possibleKeyboard isKindOfClass:NSClassFromString(@"UIKeyboard")]) | |
return possibleKeyboard.bounds.size.height; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment