我在我的应用程序中使用自定义标签栏(3 个标签)。每个选项卡都由导航控制器控制,如下所示。问题是在自动旋转方向时,根控制器上的每个自动旋转都很好,但子控制器(shouldAutorotateToInterfaceOrientation)没有响应。
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
UINavigationController *localNavigationContriller;
XXXViewController *mail;
xxx = [[XXXViewController alloc] initWithTabBar];
localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:xxx];
[localNavigationContriller.navigationBar setBarStyle:UIBarStyleDefault];
localNavigationContriller.navigationBar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1];
[localControllersArray addObject:localNavigationContriller];
[localNavigationContriller release];
[xxx release];
YYYViewController *rsvn;
yyyy = [[YYYViewController alloc] initWithTabBar];
localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:yyyy];
[localNavigationContriller.navigationBar setBarStyle:UIBarStyleDefault];
localNavigationContriller.navigationBar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1];
[localControllersArray addObject:localNavigationContriller];
[localNavigationContriller release];
[yyyy release];
TempController *tem;
tem = [[TempController alloc] initWithTabBar];
localNavigationContriller=[[UINavigationController alloc] initWithRootViewController:calendar];
[localNavigationContriller.navigationBar setBarStyle:UIBarStyleDefault];
localNavigationContriller.navigationBar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1];
[localControllersArray addObject:localNavigationContriller];
[localNavigationContriller release];
tabBarController.delegate=self;
tabBarController.viewControllers = localControllersArray;
[localControllersArray release];