UITabBarController
来源:互联网 发布:mac版淘宝客户端 编辑:程序博客网 时间:2024/05/16 11:24
修改AppDelegate.m中的代码
#import "AppDelegate.h"
#import "FirstViewController.h"
#import "SecondViewController.h"
@implementation AppDelegate
- (void)dealloc
{
[_window release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]autorelease];
self.window.backgroundColor = [UIColorwhiteColor];
//实例化对象
FirstViewController *first = [[FirstViewControlleralloc]init];
SecondViewController *second = [[SecondViewControlleralloc]init];
//创建UINavigationController
UINavigationController *nav1 = [[UINavigationControlleralloc]initWithRootViewController:first];
[first release];
UINavigationController *nav2 = [[UINavigationControlleralloc]initWithRootViewController:second];
[second release];
NSArray *arr = [NSArrayarrayWithObjects:nav1,nav2,nil];
//实例化标签控制器,并设置viewController属性为上面的数组
UITabBarController *tabBar = [[UITabBarControlleralloc]init];
tabBar.viewControllers =arr;
//配置tabBar
[nav1.tabBarItem setTitle:@"First"];
[nav2.tabBarItem setTitle:@"Second"];
//标签栏控制器作为根控制器
self.window.rootViewController = tabBar;
//更改首次选中标签
tabBar.selectedIndex = 0;
//更改标签上的角标
[nav1.tabBarItem setBadgeValue:@"1"];
[nav2.tabBarItem setBadgeValue:@"2"];
[tabBar release];
[self.windowmakeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
}
- (void)applicationWillTerminate:(UIApplication *)application
{
}
@end
- UITabbarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabbarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabbarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabBarController
- UITabBarController
- 数据同步
- C++ 阶段书籍
- DVI-A、DVI-D、DVI-I接口定义、DVI接口图和DVI接口标准介绍
- SimpleDateFormat的java的日期格式
- Objective-C运行时编程指南之动态方法决议
- UITabBarController
- using MR to compute PageRank
- flash_recovery_area满的解决办法
- 数制以及换算
- JSFL制作swf素材包
- 几个有用的JSFL程序
- 【C#】类库(dll)学习笔记
- 第一个脚印
- linux配置网络总结