【问题标题】:Any way to silence the UIDevice setOrientation warning?有什么方法可以使 UIDevice setOrientation 警告静音?
【发布时间】:2009-11-05 18:35:54
【问题描述】:

任何人有一个简单的方法来消除未记录的 UIDevice setOrientation 警告?

我发现这个piece of code 可以消除未记录的 UIPickerView setSoundsEnabled 警告。

【问题讨论】:

    标签: iphone warnings uidevice setorientation


    【解决方案1】:

    只需在.h.m 文件中的类别中声明方法即可:

    @interface UIDevice (MyPrivateNameThatAppleWouldNeverUseGoesHere)
    - (void) setOrientation:(UIInterfaceOrientation)orientation;
    @end
    

    【讨论】:

    • ... 并希望 Apple 不要在 UIDevice 上使用“(私有)”类别。我可能会称它为“(MyUndocumentedMethods)”之类的。
    • 酷——效果很好!最初设计的类别功能是为了什么?
    • 它用于扩展类的功能。 BJ Homer 是对的……你不应该使用(私人)。我将更改代码
    • 要做私有方法声明,可以说@interface UIDevice ()
    【解决方案2】:

    为什么不只订阅方向通知?它们同时得到支持和工作。

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    

    【讨论】:

    • 呵呵,我要换个方向,不听。问题源于在导航链中间有一个可定向视图。当我为只能采用纵向模式的视图离开旋转视图时,我必须强制进行更改,因为除非有方向更改,否则即将出现的只能处于纵向模式的视图将被旋转。
    【解决方案3】:

    也许您应该尝试将控制器直接添加到窗口视图中。这有点无聊,但效果很好! http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html :-)

    【讨论】:

    • 这看起来真的很有用。你知道英文版吗?我不想为此使用谷歌翻译...
    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 2015-12-22
    • 1970-01-01
    • 1970-01-01
    • 2014-07-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多