Is there some way to get UIKeyboard size programmatically. 216.0f height and 162.0f height in landscape.
Following seem to be deprecated. Is there some way that works without any warning in both 3.0 iPhone OS SDK and 4.0 iPhone OS SDK to do this..
CGSize keyBoardSize = [[[note userInfo]
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue].size;
You can get the keyboard size from the
userInfodictionary using the UIKeyboardFrameBeginUserInfoKey and the UIKeyboardFrameEndUserInfoKey instead.These two keys return a
NSValueinstance containing aCGRectthat holds the position and size of the keyboard at both the start and end points of the keyboard’s show/hide animation.Edit:
To clarify, the
userInfodictionary comes from an NSNotification instance. It’s passed to your method that you register with an observer. For example,Edit 2:
Also, please don’t forget to remove yourself as an observer in your
deallocmethod! This is to avoid a crash that would occur when the notification center tries to notify your object after its been freed.