简体   繁体   English

Autolayout在模拟器上持续存在 - XCode

[英]Autolayout persists on simulator - XCode

I'm having some issues with the rotate/autolayout feature. 我在旋转/自动布局功能方面遇到了一些问题。

It's an Universal App, Supported Interface Orientations just Landscape. 这是一个通用应用程序,支持的界面方向只是风景。 Autolayout uncheck in both storyboards. Autolayout在两个故事板中取消选中。

But, iPad simulator still rotating and moving around all items once it gets "physically" rotated... 但是,一旦“物理”旋转,iPad模拟器仍然会旋转并移动所有物品......

How can I stop this Autolayout for real? 如何才能真正阻止这种Autolayout?

Thank you very much 非常感谢你

You can put these methods in individual viewControllers to control the supported orientations or whether or not they will auto-rotate. 您可以将这些方法放在单独的viewControllers以控制支持的方向或它们是否会自动旋转。

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
    //or UIInterfaceOrientationMaskPortrait, depending on what you want
}

As a note, the above method is good enough to support both landscape orientations. 需要注意的是,上述方法足以支持两种景观方向。 Including the below method will lock the screen to just ONE of the four orientation schemes. 包括以下方法将屏幕锁定为四个方向方案中的一个。 (Turning the device 180 degrees won't rotate it--it will appear upside down.) (将设备旋转180度不会旋转它 - 它会显示为颠倒。)

- (BOOL)shouldAutorotate
{
    return NO;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM