关闭

IOS5 XCODE4.2 中关于 UIKeyboardBoundsUserInfoKey

标签: xcode4ios5deprecated
3023人阅读 评论(0) 收藏 举报
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]; 貌似都可以


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:569565次
    • 积分:6741
    • 等级:
    • 排名:第3603名
    • 原创:110篇
    • 转载:125篇
    • 译文:0篇
    • 评论:49条
    最新评论