Skip to content

Instantly share code, notes, and snippets.

@nacho4d
Created August 7, 2012 18:27
Show Gist options
  • Save nacho4d/3288095 to your computer and use it in GitHub Desktop.
Save nacho4d/3288095 to your computer and use it in GitHub Desktop.
Shift key is pressed ?
- (BOOL)_isShifted
{
BOOL res = NO;
Class uiKeyboardImpl = NSClassFromString(@"UIKeyboardImpl");
if ([uiKeyboardImpl respondsToSelector:@selector(activeInstance)]) {
id activeKeyboard = [uiKeyboardImpl performSelector:@selector(activeInstance)];
if ([activeKeyboard respondsToSelector:@selector(isShifted)]) {
res = ((BOOL)[activeKeyboard performSelector:@selector(isShifted)]);
}
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment