Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the iOS keyboard animation time

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

like image 973
Mason Avatar asked Sep 24 '11 23:09

Mason


People also ask

What is iOS animation duration?

The default value is 0. 2 seconds.

What is animation in iOS?

In iOS, animations are used extensively to reposition views, change their size, remove them from view hierarchies, and hide them. You might use animations to convey feedback to the user or to implement interesting visual effects. - developer.apple-


1 Answers

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];
    }];
like image 161
Mason Avatar answered Sep 30 '22 13:09

Mason