已弃用的错误

发布于 2024-11-08 17:49:08 字数 531 浏览 0 评论 0原文

可能的重复:
UIKeyboardBoundsUserInfoKey 已弃用,该使用什么替代?

我有以下代码有一个我想删除的问题:

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

在代码的第二行,我收到消息“UIKeyboardBoundsUserInfoKey 已弃用”。 我在论坛上读过类似的错误消息并尝试了一些方法,但我的新手思维无法修复它。

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 forum and tried a few things but my newby mind can not fix it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

-黛色若梦 2024-11-15 17:49:08

当某些东西被标记为已弃用时,您应该查看文档。您通常会找到有关替换已弃用项目的信息。在本例中,UIWindow 参考的键盘通知用户信息键部分:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html

使用 UIKeyboardFrameBeginUserInfoKey 和 UIKeyboardFrameEndUserInfoKey 而不是 UIKeyboardBoundsUserInfoKey

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

允世 2024-11-15 17:49:08

这意味着不要使用 UIKeyBoundsUserInfoKey。因为它在新的 iOS xcode 中不再存在...所以尝试使用后来的或不同的密钥..ie 看看这个教程
http: //www.w3bookmarks.com/mobile-application-development-tutorial/iphone-questions-uikeyboardboundsuserinfokey-is-deprecated-what-to-use-instead/

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/

一紙繁鸢 2024-11-15 17:49:08

您可以使用 UIKeyboardFrameEndUserInfoKey 代替 UIKeyboardBoundsUserInfoKey

You can use UIKeyboardFrameEndUserInfoKey instead of UIKeyboardBoundsUserInfoKey.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文