diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-08 10:40:14 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-08 10:40:14 -0800 |
commit | 655c7deded2bd1ac36fd5a105386691ef754ded8 (patch) | |
tree | 7fe040b0854c95390adc2c418a1df4784bde65c4 /MobileCydia.mm | |
parent | 3ab1ce0fa8a67f2deb9ab68747a8263bf20f0e1d (diff) |
I do not have objectForKey:UIKeyboardAnimation{Curve,Duration}UserInfoKey on 2.x.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 2acf3c8..ebe3971 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -5713,15 +5713,27 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [self resizeForKeyboardBounds:bounds duration:0]; } +- (void) getKeyboardCurve:(UIViewAnimationCurve *)curve duration:(NSTimeInterval *)duration forNotification:(NSNotification *)notification { + if (&UIKeyboardAnimationCurveUserInfoKey == NULL) + *curve = UIViewAnimationCurveEaseInOut; + else + [[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:curve]; + + if (&UIKeyboardAnimationDurationUserInfoKey == NULL) + *duration = 0.3; + else + [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:duration]; +} + - (void) keyboardWillShow:(NSNotification *)notification { CGRect bounds; CGPoint center; - NSTimeInterval duration; - UIViewAnimationCurve curve; [[[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] getValue:&bounds]; [[[notification userInfo] objectForKey:UIKeyboardCenterEndUserInfoKey] getValue:¢er]; - [[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&curve]; - [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&duration]; + + NSTimeInterval duration; + UIViewAnimationCurve curve; + [self getKeyboardCurve:&curve duration:&duration forNotification:notification]; CGRect kbframe = CGRectMake(round(center.x - bounds.size.width / 2.0), round(center.y - bounds.size.height / 2.0), bounds.size.width, bounds.size.height); UIViewController *base = self; @@ -5736,8 +5748,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) keyboardWillHide:(NSNotification *)notification { NSTimeInterval duration; UIViewAnimationCurve curve; - [[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&curve]; - [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&duration]; + [self getKeyboardCurve:&curve duration:&duration forNotification:notification]; [self resizeForKeyboardBounds:CGRectZero duration:duration curve:curve]; } |