Skip to content

Instantly share code, notes, and snippets.

@NorrinRadd
Created February 11, 2014 19:03
Show Gist options
  • Save NorrinRadd/8941694 to your computer and use it in GitHub Desktop.
Save NorrinRadd/8941694 to your computer and use it in GitHub Desktop.
slide keyboard in from the right. Looks for UITextEffectsWindow in jacky way.
[[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note)
{
NSLog(@"Windows: %@", [UIApplication sharedApplication].windows);
for (UIWindow *window in [UIApplication sharedApplication].windows)
{
if ([window.class.description rangeOfString:@"Text"].location != NSNotFound)
{
window.alpha = 0.0f;
}
}
}];
[[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardDidShowNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note)
{
for (UIWindow *window in [UIApplication sharedApplication].windows)
{
if ([window.class.description rangeOfString:@"Text"].location != NSNotFound)
{
window.frame = CGRectMake(window.frame.size.width * 2, window.frame.origin.y, window.frame.size.width, window.frame.size.height);
window.alpha = 1.0f;
[UIView animateWithDuration:0.5f animations:^{
window.frame = CGRectMake(0, window.frame.origin.y, window.frame.size.width, window.frame.size.height);
}];
}
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment