V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Elethom
V2EX  ›  iDev

創建和 iOS Keyboard 精確同步的動畫

  •  
  •   Elethom ·
    Elethom · 2014-06-01 18:38:32 +08:00 · 2391 次点击
    这是一个创建于 3650 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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, 避免因某些原因起始位置和鍵盤不同導致動畫參數相同而實際效果不同.
    1 条回复    2014-06-01 22:46:12 +08:00
    yautou
        1
    yautou  
       2014-06-01 22:46:12 +08:00 via iPhone
    前几天自己实现这个,也发现了他俩不一致。但我觉得微信是用的iputAccessoryView,由系统来做动画,而手Q是自己代码来的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3116 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:07 · PVG 19:07 · LAX 04:07 · JFK 07:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.