2013-10-20 8 views
6

मैं यह निर्धारित करने के लिए देख रहा हूं कि कीबोर्ड कैसे एनिमेट करेगा। आईओएस 6 पर मुझे UIKeyboardAnimationCurveUserInfoKey (जो 0-0-3 से मान के साथ) के लिए मान्य मान प्राप्त हो सकता है लेकिन फ़ंक्शन 7 का मान देता है। कीबोर्ड कैसे एनिमेट करता है? 7 के मूल्य के साथ क्या किया जा सकता है?UIKeyboardWillChangeFrameNotification UIViewAnimationCurve आईओएस 7 पर सेट 7

NSConcreteNotification 0xc472900 {name = UIKeyboardWillChangeFrameNotification; userInfo = { 
    UIKeyboardAnimationCurveUserInfoKey = 7; 
    UIKeyboardAnimationDurationUserInfoKey = "0.25"; 
    UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 216}}"; 
    UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 588}"; 
    UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 372}"; 
    UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 480}, {320, 216}}"; 
    UIKeyboardFrameChangedByUserInteraction = 0; 
    UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 264}, {320, 216}}"; 
}} 
+1

देखें http://stackoverflow.com/questions/18957476/ios-7-keyboard-animation & http://stackoverflow.com/questions/18837166/how-to-mimic-keyboard-animation-on-ios- 7-टू-एड-किया-बटन करने के लिए सांख्यिक-keyboar –

उत्तर

18

ऐसा लगता है कि कीबोर्ड एक अनियंत्रित/अज्ञात एनीमेशन वक्र का उपयोग कर रहा है।

लेकिन आप अभी भी इसका उपयोग कर सकते हैं। ब्लॉक एनिमेशन के लिए एक UIViewAnimationOptions करने के लिए इसे बदलने के लिए 16 बिट्स से यह बदलाव इसलिए

UIViewAnimationCurve keyboardTransitionAnimationCurve; 
[[notification.userInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] 
          getValue:&keyboardTransitionAnimationCurve]; 

keyboardTransitionAnimationCurve |= keyboardTransitionAnimationCurve<<16; 

[UIView animateWithDuration:0.5 
        delay:0.0 
       options:keyboardTransitionAnimationCurve 
      animations:^{ 
       // ... do stuff here 
      } completion:NULL]; 

की तरह या बस यह एक एनीमेशन वक्र के रूप में गुजरती हैं।

UIViewAnimationCurve keyboardTransitionAnimationCurve; 
[[notification.userInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] 
          getValue:&keyboardTransitionAnimationCurve]; 

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationCurve:keyboardTransitionAnimationCurve]; 
// ... do stuff here 
[UIView commitAnimations]; 
1

दुर्भाग्यवश मैं टिप्पणी नहीं कर सकता अन्यथा मैं एक नया उत्तर दर्ज करने की बजाय।

तुम भी उपयोग कर सकते हैं:

animationOptions | = animationCurve < < 16;

इसे प्राथमिकता दी जा सकती है क्योंकि यह एनीमेशन ऑप्शन पर पिछले OR = संचालन को बनाए रखेगी।