Reputation: 3
This Pickture is black out screen but build success...
My application have UINavigationCOntroller and UITabbarController. However,secondViewController is black on the display!
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//2 UIViewControllerの生成
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:nil bundle:nil];
SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
NoteFunction *noteFunction = [[NoteFunction alloc]initWithNibName:nil bundle:nil];
//3 UINavigationControllerの生成
navigationController1 = [[UINavigationController alloc]initWithRootViewController:firstViewController];
navigationController3 = [[UINavigationController alloc]initWithRootViewController:noteFunction];
//4 NavigationControllerを配列にしてまとめる
navi = [NSArray arrayWithObjects:navigationController1,navigationController3,nil];
//5 tabbarcontrollerの生成
tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
[tabBarController setViewControllers:navi animated:NO];
self.window.rootViewController = tabBarController;
noteFunction.title = @"ノート";
[window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
return YES;
Upvotes: 0
Views: 79
Reputation: 3
I have solved this program!
I write this code in "Note Function.h"
(void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"Called!ViewDidLoad");
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self.navigationController setToolbarHidden:YES animated:YES];
self.view.backgroundColor = [UIColor whiteColor];
// Do any additional setup after loading the view, typically from a nib.}
}
Upvotes: 0
Reputation: 9589
For your requirement,I will give sample coding.This is the exact solution
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
FirstViewController *firstVC = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController *firstNavVC = [[UINavigationController alloc] initWithRootViewController: firstVC];
SecondViewController *secondVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UINavigationController *secondNavVC = [[UINavigationController alloc] initWithRootViewController: secondVC];
ThirdViewController *thirdVC = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
UINavigationController *thirdNavVC = [[UINavigationController alloc] initWithRootViewController: thirdVC];
NSMutableArray *tabViewControllers = [[NSMutableArray alloc] init];
[tabViewControllers addObject:firstNavVC];
[tabViewControllers addObject:secondNavVC];
[tabViewControllers addObject:thirdNavVC];
firstNavVC.tabBarItem =
[[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"First", nil)
image:nil
tag:1];
secondNavVC.tabBarItem =
[[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"Second", nil)
image:nil
tag:2];
thirdNavVC.tabBarItem =
[[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"Third", nil)
image:nil
tag:3];
UITabBarController *tabbarController = [[UITabBarController alloc] init];
tabbarController.viewControllers = tabViewControllers;
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = tabbarController;
[self.window makeKeyAndVisible];
return YES;
}
Upvotes: 1