我想确定键盘将如何设置动画.在iOS 6上,我得到一个有效值UIKeyboardAnimationCurveUserInfoKey(应该是一个UIViewAnimationCurve0-3的值),但该函数返回值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}}";
}}
Run Code Online (Sandbox Code Playgroud)
mad*_*ik3 21
键盘似乎使用的是未记录/未知的动画曲线.
但你仍然可以使用它.要将其转换为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];
Run Code Online (Sandbox Code Playgroud)
或者只是将其作为动画曲线传递.
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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3845 次 |
| 最近记录: |