Changing the iOS keyboard animation time

2019-02-13 10:13发布

Is there a way to change the time the iOS keyboard animation takes?

1条回答
我只想做你的唯一
2楼-- · 2019-02-13 10:31

I've actually found a better solution. What you can do is programmatically make the textfield or textview a first responder within an animation with duration of your choice. Example for making the keyboard emerge over the course of one second might be:

[UIView animateWithDuration:1.0 animations:^
{
     [myTextField becomeFirstResponder];
}];

Similarly, you can make the keyboard disappear like this:

[UIView animateWithDuration:1.0 animations:^
    {
         [myTextField resignFirstResponder];
    }];
查看更多
登录 后发表回答