- (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];
[self.window makeKeyAndVisible];
FirstViewController* first = [[FirstViewController alloc]init];
//设置背景图片
SecondViewController* second = [[SecondViewController alloc]init];
second.title = @"second";
second.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"31.png"]];
[second.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"g1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"shuijiao.png"]];
second.tabBarItem.badgeValue = @"OK";
UITabBarController* tc = [[UITabBarController alloc]init];
tc.viewControllers = [NSArray arrayWithObjects:first,second, nil];
tc.selectedIndex = 0;
self.window.rootViewController = tc;
[first release];
[second release];
return YES;
}
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
FirstViewController* first = [[FirstViewController alloc]init];
//设置背景图片
first.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"31.png"]];
//设置tabBarItem选中后的图片与选中前的图片
[first.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"g1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"nn.png"]];
//设置标题
first.title = @"first";
SecondViewController* second = [[SecondViewController alloc]init];
second.title = @"second";
second.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"31.png"]];
[second.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"g1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"shuijiao.png"]];
second.tabBarItem.badgeValue = @"OK";
UITabBarController* tc = [[UITabBarController alloc]init];
tc.viewControllers = [NSArray arrayWithObjects:first,second, nil];
tc.selectedIndex = 0;
self.window.rootViewController = tc;
[first release];
[second release];
return YES;
}