【发布时间】:2014-07-16 14:57:31
【问题描述】:
我以编程方式创建了一个视图、一个 UIImageView 和一个按钮。问题是如果设备从纵向切换到横向,我需要更新它们的位置,我该怎么做?
这应该是检查设备是处于纵向还是横向模式的代码
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
}
else
{
}
}
【问题讨论】:
标签: xcode landscape-portrait programmatically-created