【问题标题】:Landescape view always in one view横向视图始终在一个视图中
【发布时间】:2010-10-06 15:51:17
【问题描述】:

我的应用程序以横向模式运行,我希望它始终以一种形式运行,即假设背景是 stackoverflow 图片,在这种情况下,堆栈将位于耳机旁边,并在用户旋转时我想要的主页按钮旁边流动iphone 180 度(仍为横向模式) 现在流量将在耳机旁边并堆叠在主页按钮旁边注意:我需要所有视图旋转而不仅仅是背景

谢谢

【问题讨论】:

    标签: iphone objective-c


    【解决方案1】:

    覆盖

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    

    在您的视图控制器中并为您想要支持的任何方向返回 YES。

    例如:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        return ((interfaceOrientation == UIInterfaceOrientationPortrait) ||
                (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
                (interfaceOrientation == UIInterfaceOrientationLandscapeRight))
    }
    

    除了倒置之外的所有方向都会返回 YES。

    【讨论】:

    • 感谢您的回答,但它在模拟器中可以 100% 工作,但在设备中却不能工作,为什么?
    • 您是否启用了方向锁定?
    • 我如何检查这个?抱歉,我对所有这些东西都不熟悉
    • 双击home键并向右滑动多任务栏以从左侧显示控件。有一个方向锁定控件。
    • 谢谢,我忘了我启用了方向锁定。一切正常
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-09
    • 2016-11-24
    相关资源
    最近更新 更多