我已经添加了一个自定义标签栏。包含更多选项卡的选项卡。标签栏界面方向问题
我的第一个标签仅支持肖像模式。 第二个选项卡具有所有方向。
选择第二个选项卡并将其保持横向模式,然后在横向模式下选择第一个选项卡时会发生问题。那时,第一个选项卡视图干净地旋转,但选项卡栏保持横向模式。
我该如何克服这种情况? 这是应在自定义标签栏控制器旋转方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (self.selectedIndex == 0) {
return [self.selectedViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
} else if (self.selectedIndex == 1) {
return YES;
}
return NO;}
这是在导航控制器
首先第一和第二视图控制器应该旋转方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);}
二
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;}
保持横向的标签栏是自定义的吗?你是如何添加到屏幕上的? – 2011-05-02 10:48:59
@Terente Ionut Alexandru \t \t navigationController_ = [[UINavigationController alloc] initWithRootViewController:tabBarController_]; \t [self.window addSubview:navigationController_.view]; – xydev 2011-05-03 08:48:32