UITabbar と UINavigation
iPhone SDK にて、基本的に Interface Builder を使わないということを前提にして、UITabbar と UINavigation を共存させるにはどうすればよいかと。
Google や Yahoo! で調べてもヒットするのは、Interface Builder を使っている説明ばかりなので、自力でなんとかするしかないのかな。
ってことでやってみた。
TableViewController と ViewController02 のファイルは事前に作成しておいて。
AppDelegate.h で
UIViewController *rootController;
AppDelegate.m で
#import "TableViewController.h"
#import "ViewController02.h"
・
・
・
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
rootController = [[UITabBarController alloc] init];
TableViewController *tab1 = [[TableViewController alloc] init];
tab1 = [[UINavigationController alloc] initWithRootViewController:tab1];
ViewController02 *tab2 = [[ViewController02 alloc] init];
NSArray *controllers = [NSArray arrayWithObjects:tab1, tab2, nil];
[(UITabBarController*)rootController setViewControllers:controllers animated:NO];
[window addSubview:rootController.view];
[window makeKeyAndVisible];
時間が経つと忘れそうなので、ここに記録。(;^_^A
Google や Yahoo! で調べてもヒットするのは、Interface Builder を使っている説明ばかりなので、自力でなんとかするしかないのかな。
ってことでやってみた。
TableViewController と ViewController02 のファイルは事前に作成しておいて。
AppDelegate.h で
UIViewController *rootController;
AppDelegate.m で
#import "TableViewController.h"
#import "ViewController02.h"
・
・
・
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
rootController = [[UITabBarController alloc] init];
TableViewController *tab1 = [[TableViewController alloc] init];
tab1 = [[UINavigationController alloc] initWithRootViewController:tab1];
ViewController02 *tab2 = [[ViewController02 alloc] init];
NSArray *controllers = [NSArray arrayWithObjects:tab1, tab2, nil];
[(UITabBarController*)rootController setViewControllers:controllers animated:NO];
[window addSubview:rootController.view];
[window makeKeyAndVisible];
時間が経つと忘れそうなので、ここに記録。(;^_^A