UINavigationController与UITabBarController

@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,retainIBOutlet UINavigationController *navController1;

@property (nonatomic,retainIBOutlet UINavigationController *navController2;

@property (nonatomic,retainIBOutlet UINavigationController *navController3;

@property (nonatomic,retainIBOutlet UINavigationController *navController4;

@property (nonatomic,retainIBOutlet UINavigationController *navController5;

@property (nonatomic,retainIBOutlet UISegmentedControl *segmentedController;

@property (nonatomic,retainIBOutlet 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 = [NSArrayarrayWithObjects:navController1,navController2,navController3,navController4,navController5,nil];

 

 

tabBarController.viewControllers = controllers;

 

 

[self.window addSubview:tabBarController.view];

    [self.window makeKeyAndVisible];

    

    return YES;

}


转帖:http://blog.sina.com.cn/s/blog_833996210100read.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值