浓浓的巧克力

宝刀本应向天啸,奈何英雄漂泊身。

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 ios5 deprecated
想对作者说点什么? 我来说一句

Beginning.iOS.5.Development

2012年03月06日 53.12MB 下载

没有更多推荐了,返回首页

不良信息举报

IOS5 XCODE4.2 中关于 UIKeyboardBoundsUserInfoKey

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭