2013-10-20 7 views
6

Ich suche, wie die Tastatur animieren wird. Auf iOS 6 bekomme ich einen gültigen Wert für die UIKeyboardAnimationCurveUserInfoKey (die eine UIViewAnimationCurve mit einem Wert von 0-3 sein sollte) Funktion gibt einen Wert von 7 zurück. Wie animiert die Tastatur? Was kann mit dem Wert 7 getan werden?UIKeyboardWillChangeFrameNotification UIViewAnimationCurve auf iOS 7 auf 0 gesetzt

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

Siehe http://stackoverflow.com/questions/18957476/ios-7-keyboard-animation & http://stackoverflow.com/questions/18837166/how-to-mimic-keyboard-animation-on-ios- 7-to-add-done-button-to-numeric-keyboar –

Antwort

18

Es scheint, dass die Tastatur eine undokumentierte/unbekannte Animationskurve verwendet.

Aber Sie können es immer noch verwenden. Um zu wandeln es in ein UIViewAnimationOptions für Block Animationen verschieben es um 16 Bits wie so

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]; 

Oder es nur als Animation Kurve passieren in.

1

kann ich leider nicht kommentieren sonst würde ich statt eine neue antwort eingeben.

Sie können auch verwenden:

animationOptions | = animationCurve < < 16;

Dies ist möglicherweise vorzuziehen, da vorherige OR = -Operationen für die animationOptions beibehalten werden.