横向模式下设置视图中的问题

时间:2011-06-16 05:24:41

标签: iphone objective-c ipad landscape uiinterfaceorientation

enter image description here我有一个基于标签的应用程序,其中4个视图与4个标签相关联。我希望以纵向形式显示所有3个视图,只需要一个横向视图。

我已为该特定视图完成了以下设置:

在info.plist的支持接口方向中设置所需的值。

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

在IB中将orientation属性设置为landscape。

-(void)viewDidLoad我已设置self.view.frame=CGRectMake(0, 0, 480, 320);

完成上述所有设置后,仍未进入横向模式。

1 个答案:

答案 0 :(得分:1)

如果我正确理解了您的问题,如果我不理解请纠正我,那么您希望纵向有3个视图所有,而有一个视图在风景中所有时间即可。要完成此操作,请在viewWillAppear

中为每个viewController设置状态栏的方向
-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
}
相关问题