如何创建在纵向和横向模式下都能工作的通用ios应用程序?

时间:2013-07-30 12:03:56

标签: ios universal

我正在尝试开发通用iOS应用程序,以便在纵向和横向模式下都能正常工作。但是我无法触发一个操作来加载我在设备中方向更改视图上的横向视图

1 个答案:

答案 0 :(得分:1)

创建您的应用程序,然后在您的应用程序摘要中转到支持的界面方向并选择您要激活的应用程序:

Supported Interface Orientations

然后,您可以使用以下两种方法之一:

如果操作在旋转之前,则从UIViewController覆盖:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
 // do something before rotation
}

如果您想在轮换后执行某些操作:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
 // do something after rotation
}
相关问题