Objective c 如何在设备';s方向是应用程序中的任意位置的横向,并在纵向时切换到横向视图?

Objective c 如何在设备';s方向是应用程序中的任意位置的横向,并在纵向时切换到横向视图?,objective-c,ios,uideviceorientation,Objective C,Ios,Uideviceorientation,嘿,在我的应用程序中,每当设备处于横向模式时,无论用户处于哪个视图,我都必须加载特定视图。还必须将其切换回设备切换到纵向时用户所在的最后一个视图 有什么建议吗?或者链接到任何教程???也许您可以尝试编写自己的UIViewController子类,它只在界面方向更改时实现自定义视图的外观。大概是这样的: - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ D

嘿,在我的应用程序中,每当设备处于横向模式时,无论用户处于哪个视图,我都必须加载特定视图。还必须将其切换回设备切换到纵向时用户所在的最后一个视图


有什么建议吗?或者链接到任何教程???

也许您可以尝试编写自己的UIViewController子类,它只在界面方向更改时实现自定义视图的外观。大概是这样的:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
     DetailViewController *dvc = [[DetailViewController alloc] initWithNibName:@"DetailViewController_iPhone" bundle:[NSBundle mainBundle]];
    }
    //navigation controller ruft den bdv Controller auf
    [self.navigationController pushViewController:dvc animated:YES];
    [dvc release];

}
您的所有其他类现在都从该自定义UIViewController继承。 当然,只有当所有视图都有ViewController时,这才是一个解决方案

希望能有帮助