Way to get keyboard frame/animation {duration, curve}
| Originator: | zach | ||
| Number: | rdar://10737012 | Date Originated: | 22-Jan-2012 |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 5.0 |
| Classification: | Enhancement | Reproducible: | N/A |
Request:
A way to get the current keyboard bound(s)[1], animation timing for appearance/dismissal, and the animation curve when the keyboard is presented/dismissed.
Reason:
When working with user input on iOS 5, the only way to determine the keyboard frame or animation duration/curve is to look at the UIKeyboard{Will, Did}{Show, Hide}Notification's that are posted.
While it is very nice to be able to access this info, it does lead to a certain amount of boilerplate code throughout my application. I typically have a number of view controllers in my application that need to know this info in order to lay elements out properly[2], and this leads to the same notifications being observed/unobserved and the same three lines of code being pasted in, to get the keyboard frame, animation duration, and animation curve.
Another time when it would be nice to have this information is when working with custom input views — say, a date picker control — that needs to be presented and dismissed on its own. The only surefire way to animate this is to make up my own defines that happen to be equal to whatever OS I checked on happens to have the values as[3]. It would be nice to have the animations match the system input.
Notes:
1. In cases of the split keyboard, it would be nice to know where both sides are, to avoid having elements hidden by the keyboard.
2. A sign in view controller that adjusts the contentOffset in landscape to show the correct input view, a sign up view controller to make an account that has > 3 fields and is then cut off by the keyboard, a chat input view that moves a UITextField and the conversation view up and down, based on if a keyboard is up or not.
3. I cannot save the animation duration/curve and keyboard frame because there is no guarantee that the user will not select this field first, and at that point, the values haven't been set yet.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!