//*.h
@class IndexViewController;
@interface MyNavigationController : NSObject <UIApplicationDelegate>{
//...
}
//主畫面
@property (nonatomic, retain) IBOutlet UIWindow *window;
//最初要呈現在根視圖上的 ViewController
@property (nonatomic, retain) IBOutlet IndexViewController *indexViewController;
//導覽列
@property (nonatomic, retain) UINavigationController *_navigationController;
@end
//*.m
#import "IndexViewController.h"
//頁面讀取完成後的設定
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
//產生新的 NavigationController : 並將 IndexViewController 設為 RootViewController ( 最初始顯示的根視圖 )
self._navigationController = [[[UINavigationController alloc] initWithRootViewController:self.homeViewController] autorelease];
//可在這裡設定 NavigationController 的各式屬性
//...
//加入 NavigationController : 設定 RoowViewController 根視圖
self.window.rootViewController = self._navigationController;
//顥示 Window View
[self.window makeKeyAndVisible];
return YES;
}