次の方法で6つのViewControllerを作成しました。
Truck_Tracker_AppAppDelegate *delegate = (Truck_Tracker_AppAppDelegate *)UIApplication.sharedApplication.delegate;
UIViewController *viewController1 = [[TrucksViewController alloc] initWithNibName:@"TrucksView" bundle:nil];
UIViewController *viewController2 = [[MapViewController alloc] initWithNibName:@"MapView" bundle:nil];
UIViewController *viewController3 = [[BlockPartyViewController alloc] initWithNibName:@"BlockPartyView" bundle:nil];
UIViewController *viewController4 = [[FavoritesViewController alloc] initWithNibName:@"FavoritesView" bundle:nil];
UIViewController *viewController5 = [[UserSettingsViewController alloc] initWithNibName:@"UserSettingsView" bundle:nil];
UIViewController *viewController6 = [[TOSettingsViewController alloc] initWithNibName:@"TOSettingsView" bundle:nil];
viewController1、3、および4をプログラムでナビゲーションコントローラーにラップする必要があります。私はこれをAppleDeveloperのWebサイトで見つけました。
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
UIViewController *myViewController = [[MyViewController alloc] init];
navigationController = [[UINavigationController alloc]
initWithRootViewController:myViewController];
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.rootViewController = navigationController;
[window makeKeyAndVisible];
}
しかし、viewControllersを作成した場所でそれを行う必要があります。何か案は?