UINavigationController与UITabBarController

来源:互联网 发布:国学大师软件 编辑:程序博客网 时间:2024/05/24 16:14
@interface __2AppDelegate : NSObject <UIApplicationDelegate> {    UIWindow *window;UINavigationController *navController1;UINavigationController *navController2;UINavigationController *navController3;UINavigationController *navController4;UINavigationController *navController5;UISegmentedControl *segmentedController;UITabBarController *tabBarController;} @property (nonatomic, retain) IBOutlet UIWindow *window;@property (nonatomic,retain) IBOutlet UINavigationController *navController1;@property (nonatomic,retain) IBOutlet UINavigationController *navController2;@property (nonatomic,retain) IBOutlet UINavigationController *navController3;@property (nonatomic,retain) IBOutlet UINavigationController *navController4;@property (nonatomic,retain) IBOutlet UINavigationController *navController5;@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedController;@property (nonatomic,retain) IBOutlet UITabBarController *tabBarController; @end@synthesize window;@synthesize navController1;@synthesize navController2;@synthesize navController3;@synthesize navController4;@synthesize navController5;@synthesize segmentedController;@synthesize tabBarController;#pragma mark -#pragma mark Application lifecycle- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {            // Override point for customization after application launch.    tabBarController = [[UITabBarController alloc] init];  homeViewController *homeController = [[homeViewController alloc] init];homeController.title = @"蓝天l风烨堞";navController1 = [[UINavigationController alloc] initWithRootViewController:homeController];[homeController release];  messageViewController *messageController = [[messageViewController alloc] init];messageController.title = @"信息";UITabBarItem *item1 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemHistory tag:0];messageController.tabBarItem = item1;[item1 release];navController2 = [[UINavigationController alloc] initWithRootViewController:messageController];[messageController release];  mineViewController *mineController = [[mineViewController alloc] init];mineController.title = @"我的资料";UITabBarItem *item2 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemContacts tag:0];mineController.tabBarItem = item2;[item2 release];navController3 = [[UINavigationController alloc] initWithRootViewController:mineController];[mineController release];  searchViewController *searchController = [[searchViewController alloc] init];searchController.title = @"搜索";UITabBarItem *item3 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:0];searchController.tabBarItem = item3;[item3 release];navController4 = [[UINavigationController alloc] initWithRootViewController:searchController];[searchController release];  moreViewController *moreController = [[moreViewController alloc] init];moreController.title = @"更多";UITabBarItem *item4 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMore tag:0];moreController.tabBarItem = item4;[item4 release];navController5 = [[UINavigationController alloc] initWithRootViewController:moreController];[moreController release];  NSArray *controllers = [NSArray arrayWithObjects:navController1,navController2,navController3,navController4,navController5,nil];  tabBarController.viewControllers = controllers;  [self.window addSubview:tabBarController.view];    [self.window makeKeyAndVisible];        return YES;}