、ユーザーが質問を編集したため、もう一度回答しています。NavigationController で tabBar が必要な場合
IN AppDelegate.h appDelegate.mUINavigationController *navController;
でプロパティを定義して作成し、合成します。
すべての ViewController クラスを AppDelegate.m にインポートします
お気に入り
#import "ViewController.h"
#import "Preview.h"
#import "Export.h"
#import "Settings.h"
#import "More.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
tabBarController = [[UITabBarController alloc] init];
tabBarController.delegate=self;
//Adding Search,Nearby,Map,AboutUs,Favorites Tabs to tabBarController
ViewController * search = [[ViewController alloc] init];
UINavigationController *searchNav = [[UINavigationController alloc] initWithRootViewController:search];
Preview* nearby = [[Preview alloc] init];
UINavigationController *nearbyNav = [[UINavigationController alloc] initWithRootViewController:nearby];
Export* map = [[Export alloc] init];
UINavigationController *mapNav = [[UINavigationController alloc] initWithRootViewController:map];
Settings* aboutUs = [[Settings alloc] init];
UINavigationController *aboutUsNav = [[UINavigationController alloc] initWithRootViewController:aboutUs];
More* favorites = [[More alloc] init];
UINavigationController *favoritesNav = [[UINavigationController alloc] initWithRootViewController:favorites];
NSArray* controllers = [NSArray arrayWithObjects:searchNav,nearbyNav,mapNav,aboutUsNav,favoritesNav, nil];
tabBarController.viewControllers = controllers;
[self.window addSubview:tabBarController.view];
// self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
// self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
これはあなたを助けるかもしれません。