Possible Duplicate:
UIKeyboardBoundsUserInfoKey is deprecated, what to use instead?
I have the following code with an issue which I would love to remove:
NSDictionary* info = [notif userInfo];
NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
CGSize keyboardSize = [aValue CGRectValue].size;
On the second line of the code I get the message "UIKeyboardBoundsUserInfoKey is deprecated". I,ve read similar error messages on the f开发者_StackOverflow中文版orum and tried a few things but my newby mind can not fix it.
You should check out the docs anytime something is marked as deprecated. You will usually find info about what has replaced the deprecated item. In this case, the Keyboard Notification User Info Keys section of the UIWindow reference:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html
Use UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey instead of UIKeyboardBoundsUserInfoKey
it means that DONT USE UIKeyBoundsUserInfoKey. because it is not present anymore in the new iOS xcode... so try to use the later or different key..i.e look at this tutorial http://www.w3bookmarks.com/mobile-application-development-tutorial/iphone-questions-uikeyboardboundsuserinfokey-is-deprecated-what-to-use-instead/
You can use UIKeyboardFrameEndUserInfoKey
instead of UIKeyboardBoundsUserInfoKey
.
精彩评论