Skip to content

Commit

Permalink
Merge pull request #1 from birthdayalarm/master
Browse files Browse the repository at this point in the history
Fix animation code for iOS7
  • Loading branch information
aceontech committed Jan 14, 2014
2 parents 8cc5aeb + bafe33b commit df97b7e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions KBKeyboardHandler/Classes/KBKeyboardHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ - (void)retrieveFrameFromNotification:(NSNotification *)notification

- (void)notifySizeChanged:(CGSize)delta notification:(NSNotification *)notification
{
assert(self.delegate);

NSDictionary *info = [notification userInfo];

UIViewAnimationCurve curve;
Expand All @@ -84,15 +86,15 @@ - (void)notifySizeChanged:(CGSize)delta notification:(NSNotification *)notificat
NSTimeInterval duration;
[[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&duration];

void (^action)(void) = ^{
[self.delegate keyboardSizeChanged:delta];
};

[UIView animateWithDuration:duration
delay:0.0
options:curve
animations:action
completion:nil];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]];
[UIView setAnimationCurve:[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]];
[UIView setAnimationBeginsFromCurrentState:YES];

[self.delegate keyboardSizeChanged:delta];

[UIView commitAnimations];
}

@end

0 comments on commit df97b7e

Please sign in to comment.