2013-10-20 20 views
6

Tôi đang tìm cách xác định cách thức hoạt động của bàn phím. Trên iOS 6, tôi nhận được giá trị hợp lệ cho UIKeyboardAnimationCurveUserInfoKey (phải là UIViewAnimationCurve với giá trị từ 0-3) nhưng chức năng trả về một giá trị của 7. Làm thế nào để bàn phím animate trong? Điều gì có thể được thực hiện với giá trị 7?UIKeyboardWillChangeFrameNotification UIViewAnimationCài đặt thành 7 trên iOS 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

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

Trả lời

18

Có vẻ như bàn phím đang sử dụng đường cong hoạt ảnh không được đăng ký/chưa biết.

Nhưng bạn vẫn có thể sử dụng nó. Để chuyển đổi nó thành một UIViewAnimationOptions cho hình động khối thay đổi nó bằng 16 bit như vậy

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

Hoặc chỉ cần chuyển nó làm đường cong hoạt hình.

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

Tôi không thể nhận xét không may nếu không tôi sẽ thay vì nhập câu trả lời mới.

Bạn cũng có thể sử dụng:

animationOptions | = animationCurve < < 16;

Điều này có thể được ưa thích vì nó sẽ giữ lại OR trước đó = hoạt động trên animationOptions.

Các vấn đề liên quan