最初在ios sdk中以横向模式打开视图控制器

最初在ios sdk中以横向模式打开视图控制器,ios,uiviewcontroller,Ios,Uiviewcontroller,我正在使用iOSSDK5 我像这样从父视图控制器推送视图控制器 DetailsViewController *detailController = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:nil] ; [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscape

我正在使用iOSSDK5

我像这样从父视图控制器推送视图控制器

DetailsViewController *detailController = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:nil] ;
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:YES];
[self.navigationController pushViewController:detailController animated:YES];
因为我想在横向模式下打开我的新控制器。我的父视图控制器处于potrait模式,所以我已设置为

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}
在我的子视图控制器中,我将其设置为

   - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
         return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
    }
但当我的子视图控制器打开时,它仍会旋转到横向模式,但内部视图(如scrollview)及其子视图仍处于potrait模式。我读过很多类似的问题,并尝试过,但没有一个适合我。请告诉我如何在viewcontroller中旋转所有视图的正确方向


谢谢

只要更换方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
     return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}


我尝试了K.D,但它仍然没有旋转滚动视图及其内部视图。如果您希望您的视图是横向视图,请返回UIInterfaceOrientation横向视图(interfaceOrientation),并在.plist文件中仅设置横向方向,并从中删除其他方向。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
     return  UIInterfaceOrientationIsPortrait(interfaceOrientation);
}