Objective c 应自动旋转指针面方向单个视图

Objective c 应自动旋转指针面方向单个视图,objective-c,Objective C,如何设置我的单个视图应该执行的方向? 下面这张图片可以给我所有的方向,但在特定的视图中,我不想旋转 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } 谢谢 只要这样做: - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interf

如何设置我的单个视图应该执行的方向? 下面这张图片可以给我所有的方向,但在特定的视图中,我不想旋转

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
 return YES;
}
谢谢

只要这样做:

- (BOOL)shouldAutorotateToInterfaceOrientation:   (UIInterfaceOrientation)interfaceOrientation
{
     //Or UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight
     return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
只要这样做:

- (BOOL)shouldAutorotateToInterfaceOrientation:   (UIInterfaceOrientation)interfaceOrientation
{
     //Or UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight
     return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

是的,但当我这样做时,它适用于TabBar中的每个视图。请更详细地解释您的问题。我有一个包含4个视图的TabBar,好吗?我将我的应用程序设置为在所有方向上旋转。但在其中一个视图中,我需要锁定旋转。当我将shouldAutorotateToInterfaceOrientation方法返回到YES时,它会在所有视图中旋转。然后只需在主视图中签入shouldAutorotateToInterfaceOrientation方法。检查选择了哪个选项卡栏项。如果它是你想要锁定的,锁定它的方向。我试过了,但没有成功。如果我在app delegate上声明shouldAutorotateToInterfaceOrientation,它甚至可以工作。是的,但当我这样做时,它适用于TabBar中的每个视图。请更详细地解释您的问题。我有一个包含4个视图的TabBar,好吗?我将我的应用程序设置为在所有方向上旋转。但在其中一个视图中,我需要锁定旋转。当我将shouldAutorotateToInterfaceOrientation方法返回到YES时,它会在所有视图中旋转。然后只需在主视图中签入shouldAutorotateToInterfaceOrientation方法。检查选择了哪个选项卡栏项。如果它是你想要锁定的,锁定它的方向。我试过了,但没有成功。如果我在app委托上声明shouldAutorotateToInterfaceOrientation,它甚至可以工作。