我正在开发一个应用程序,它应该同时支持人像和景观方向。使用自动布局重新排列视图中的控件是没有问题的,但是我不能用自动布局来做一些事情。我在人像视图下有两个视图,我希望它们在风景视图中彼此相邻。我可以移动底部的视图在正确的X位置,但它仍然在顶部的视图。这张照片描述了我想要做的事情:
http://www.hesamstore.ir/Orient.png
我该怎么做?
感谢您的阅读。
发布于 2014-09-02 11:51:14
向所有IBOutlets添加约束。
添加约束- 1。高度,宽度,尾随和领先,这将解决它,如果你想要准确的比率,然后选择两个出口,并添加水平约束与比率。
并选择一个标签及其相应的开关,并添加水平间距并使其相等。
是的,这应该行。
发布于 2014-09-02 11:50:38
只需在代码中实现此方法..。
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
BOOL isPortrait = UIDeviceOrientationIsPortrait(self.interfaceOrientation);
if(isPortrait == NO)
{
// this is landScape mode....
// here give the frames that you want for your controls...
}
if(isPortrait == YES)
{
// this is portrait mode....
// here give the frames that you want for your controls...
}
}https://stackoverflow.com/questions/25622652
复制相似问题