My AppDelegate.h
//
// AppDelegate.h
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UIWindow *window;
UITabBarController *tabBarController;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UITabBarController *tabBarController;
@end
My AppDelegate.m
//
// AppDelegate.m
//
#import "AppDelegate.h"
#import "AppNavigationController.h"
#import "ExamViewController.h"
#import "SignsViewController.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
- (void)dealloc
{
[_tabBarController release];
[_window release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
// Initializating our Tab Bar Controller
tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
// Exam Controller Setup
ExamViewController *examViewController = [[ExamViewController alloc] initWithStyle:UITableViewStylePlain];
AppNavigationController *examNavigationController = [[AppNavigationController alloc] initWithRootViewController:examViewController];
examViewController.title = @"Экзамен";
examViewController.tabBarItem.image = [UIImage imageNamed:@"icon_exam.png"];
// -------------------------------------
// Signs Controller Setup
SignsViewController *signsViewController = [[SignsViewController alloc] initWithStyle:UITableViewStylePlain];
AppNavigationController *signsNavigationController = [[AppNavigationController alloc] initWithRootViewController:signsViewController];
signsViewController.title = @"Знаки";
signsViewController.tabBarItem.image = [UIImage imageNamed:@"icon_signs.png"];
// -------------------------------------
[tabBarController setViewControllers:[NSArray arrayWithObjects:examNavigationController, signsNavigationController, nil]];
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
[examNavigationController release];
[examViewController release];
[signsNavigationController release];
[signsViewController release];
return YES;
}
Также у меня есть пустой UINavigationController.
Я хочу реализовать настраиваемую панель навигации для всех контроллеров представления, которые ее используют.
Например: теперь у меня есть только два view-контроллера
Но, вероятно, я хотел бы добавить две или более вкладок и хочу настроить панель навигации в одном месте.
Поэтому возникает вопрос: как настроить панель навигации в одном месте, чтобы она выглядела одинаково в каждом контроллере вида, не настраивая ее в каждом контроллере вида в методе viewDidLoad?