The Devil is in the detail.
可以從中看出 app 的作者是否用心的一個小細節. 例如同樣出自騰訊的兩枚 IM 應用, 微信的鍵盤彈出動畫就是同步的, 而 QQ 不是.
http://blog.projectrhinestone.org/ios-keyboard-animation-syncing/有兩個重點:
1. 所有參數都要動態獲取, 包括鍵盤 frame 變化前後所占高度 (可以通過查看 view hierarchy 發現鍵盤是在 screen 上的, 再據此計算出所占高度) 和動畫的參數;
2. 在動畫開始之前也要先設置好 frame 並將 begin from current state 設為 NO, 避免因某些原因起始位置和鍵盤不同導致動畫參數相同而實際效果不同.