IOS5 XCODE4.2 中关于 UIKeyboardBoundsUserInfoKey

NSDictionary* info = [notification  userInfo];
NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
CGSize keyboardSize = [aValue  CGRectValue]. size;


获取键盘size时, 提示警告:

warning: 'UIKeyboardBoundsUserInfoKey' is deprecated (declared at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h:118

用什么可以代替UIKeyboardBoundsUserInfoKey,或者用其他的方法获得键盘的大小,总之把警告解决就好。


============================

Simply use “UIKeyboardFrameBeginUserInfoKey” instead:

NSValue *aValue = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];

=============================

改为NSValue* aValue = [info objectForKey:@"UIKeyboardBoundsUserInfoKey"];就可以了

=============================

NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
NSValue *aValue = [info objectForKey:UIKeyboardFrameBeginUserInfoKey]; 貌似都可以


你可能感兴趣的:(XCode4,deprecated,ios5)