【发布时间】:2016-02-23 12:44:11
【问题描述】:
我正在编写一个 iPhone 应用程序。对于我们故事板上的大多数场景,手机从纵向变为横向时的默认行为是可以的。 IE。这是我们想要的布局更改:
但是对于故事板中的一个场景,我不希望这种布局改变。相反,我想要这个:
我对如何实现后一种布局更改感到困惑。我可以使用大小类来确保工具栏的 100 像素间隙从底部(纵向)到右侧(横向)交换,但我无法弄清楚如何正确约束工具栏,特别是因为旋转需要在代码中发生,例如
switch (UIDevice.currentDevice().orientation) {
case UIDeviceOrientation.LandscapeLeft, UIDeviceOrientation.LandscapeRight:
self.toolbarView.transform = CGAffineTransformMakeRotation(CGFloat(3 * M_PI_2))
// Reposition toolbarView into space to the right of the content's view
break
default:
self.toolbarView.transform = CGAffineTransformIdentity
break
}
我应该怎么做才能正确地重新定位工具栏?
【问题讨论】:
标签: swift uistoryboard size-classes screen-rotation