Skip to content

Instantly share code, notes, and snippets.

View scandidavian's full-sized avatar

David Wisti scandidavian

View GitHub Profile
@scandidavian
scandidavian / gist:3057547
Created July 6, 2012 01:50
iOS Keyboard animation to scroll to a UITextField contained in a UITableViewCell
- (void)keyboardWillShow:(NSNotification*)notification
{
NSValue* keyboardFrameValue = [notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardFrame = [keyboardFrameValue CGRectValue];
keyboardFrame = [self.view convertRect:keyboardFrame fromView:nil];
CGFloat tableViewHeight = CGRectGetMinY(keyboardFrame) - CGRectGetMinY(self.view.bounds);
// Get the duration of the animation.
NSValue* animationDurationValue = [notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];