3つのタブを含むTabbarコントローラーを備えたアプリがあります。最初のタブにナビゲーションコントローラーを追加する必要があります。私のルートViewコントローラーはタブバーですが、ナビゲーションバーを追加するにはどうすればよいですか?ナビゲーションバーを初期化しましたが、どこに設定すればよいかわかりません。あなたがより多くの情報を必要とするかどうか助けて尋ねることができる誰かに感謝します。これは私のアプリデリゲートです。m:
#import "TACAppDelegate.h"
#import "FirstViewController.h"
#import "ThirdViewController.h"
#import "SecondViewController.h"
@implementation TACAppDelegate
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/* Initialize window view */
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
/* Initialize tab bar controller, add tabs controllers */
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [self initializeTabBarItems];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return (YES);
}
....
- (NSArray *)initializeTabBarItems
{
NSArray * retval;
/* Initialize view controllers */
FirstViewController *viewController1 = [[FirstViewController alloc] init];
SecondViewController *viewController2 = [[SecondViewController alloc] init];
ThirdViewController *viewController3 = [[ThirdViewController alloc] init];
/* Initialize navigation controllers */
UINavigationController *navigationController1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
/* Stuff Navigation Controllers into return value */
retval = [NSArray arrayWithObjects:viewController1,viewController2,viewController3,nil];
return (retval);
}
@end