本文介紹了更改 iOS 鍵盤動畫時間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
有沒有辦法改變 iOS 鍵盤動畫所花費的時間?
Is there a way to change the time the iOS keyboard animation takes?
推薦答案
其實我找到了更好的解決方案.您可以做的是以編程方式使 textfield 或 textview 在動畫中成為您選擇的持續時間的第一響應者.使鍵盤在一秒鐘內出現的示例可能是:
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];
}];
這篇關于更改 iOS 鍵盤動畫時間的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!